Ajay Yadav 🎯 Profile picture
Mar 22 β€’ 9 tweets β€’ 3 min read
πŸ’› Day 2️⃣1️⃣ / 3️⃣0️⃣ days of basics in JavaScript series!

β†’ What is a ternary operator?

β†’ The conditional ternary operator in JavaScript?

β†’ The conditional operator in a template literal?

#javascript30
πŸ“Œ What is a ternary operator?

β†’ Which operator takes 3 operands that are a ternary operator.

πŸ’š In short:

1 operand : Unary operator
2 operand : Binary operator
3 operand : Ternary operator
πŸ“Œ The conditional (ternary) operator in JavaScript?

β†’ This is similar to the "if" and "else" statements but in a single line.

β†’ This is an operator, which produces a value.

β†’ There are 3 parts of this operator.

Have a look!πŸ‘€πŸ‘‡
πŸ“Œ Here are the 3 parts of the ternary operator.

1️⃣ Condition
2️⃣ True expression
3️⃣ False expression
1️⃣ Condition

β†’ This is a condition similar to the "if" and "else" statements, which produce a boolean value.

β†’ If the condition is true then the "true expression" will be executed otherwise "false expression" will be executed.
2️⃣ True expression

β†’ This expression will be executed when the condition is true.

3️⃣ False expression

β†’ This expression will be executed when the condition is false.
πŸ“Œ The conditional operator in a template literal?

β†’ We can also use the operator in the template literal.
πŸ“Œ Access previous threads from this Twitter moment.

twitter.com/i/events/14992…
πŸ’š That's all for now, we will meet in the next thread!

But if you like make sure to:

1. Follow me @ATechAjay

2. Retweet the first tweet.

3. Turn on the notification to never miss these amazing tweets.

Thank you so much for staying to the end of this thread.

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Ajay Yadav 🎯

Ajay Yadav 🎯 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @ATechAjay

Mar 23
πŸ”₯ Design a hoverable background like this using only 2 lines of code.

πŸ‘€πŸ‘‡
πŸ“Œ This background is "before" pseudo-element.

πŸ“Œ Just you have to scale the background from 0 to 1. Image
πŸ“Œ Codepen link:

codepen.io/atechajay/pen/…
Read 4 tweets
Mar 23
β›” How to protect your eyes as a programmer?

β›” How to protect your eyes as a coder?

β›” How to keep healthy for your eyes as a web programmer?

A ThreadπŸ§΅β‡© Image
β›” Note:

πŸ“Œ I am not a doctor, just share this guide on the basis of my research and ability.

πŸ“Œ I will share my used tools for caring for my eyes as well as some personal guidance on it.

Let's start...
πŸ“Œ Drink water more and more!

β†’ As we already know that approx 60% of water is in our bodies.

β†’ Drinking water will help flush out salt or harmful element in the body and properly hydrate your eyes to help reduce eye strain.
Read 16 tweets
Mar 21
πŸ’› Day 2️⃣0️⃣ / 3️⃣0️⃣ days of basics in JavaScript series!

β†’ What is a Switch statement?

β†’ What are the "break" & "default" keywords?

β†’ What is a Switch statement in multiple cases?

β†’ Strict comparison with switch statement?

#javascript30 Image
πŸ“ŒWhat is a Switch statement?

β†’ Switch statements are similar to if and else if statements with differences.

β†’ Switch statements also executed the block of code based on the switch condition.

β†’ Using switch statements we can select a particular block of code based on cases.
πŸ“Œ Syntax of switch statement!

switch(condition/case){

case 1:{
...
break;
}

case 2:{
...
break;
}

case 3:{
...
break;
}

default:{
...
}

} Image
Read 9 tweets
Mar 12
πŸ“Œ Do you know??

β†’ The HTML structure is also confusing for many developers.

β†’ Learn how to build structures for this login form.

β†’ That means which item going to be kept in another container.

β†’ Once we build the structure of the page, then very easy for the design.

πŸ§΅β†“
1
2
Read 10 tweets
Mar 11
πŸ’› Day 1️⃣1️⃣ / 3️⃣0️⃣ days of basics in JavaScript series

β†’ Arithmetic operator?

β†’ Prefix & Postfix operator?

β†’ Assignment operator?

β†’ Comparision operator?

β†’ == VS === operator?

β†’ Logical operator?

β†’ String operator?

#javascript30

Let me explain!πŸ§΅πŸ‘‡
πŸ“Œ Arithmetic operator?

β†’ It is used to perform mathematical calculations.

πŸ‘€ +, -, %, *, **, etc

β†’ ** is a square operator or power operator.

πŸ‘€ 2**3 = 2x2x2
β†’ % is a modulus operator, not a percentage.

β†’ It is used to find the remainder of an expression.

πŸ‘€ 11 % 10 = remainder ( 1 )
Read 14 tweets
Mar 10
πŸ’› Day 1️⃣0️⃣ / 3️⃣0️⃣ days of basics in JavaScript series

β†’ What is an expression?

β†’ What is an operator?

β†’ What is an operand?

β†’ What is a unary operator, binary operator, ternary operator?

#javascript30

Let me explain!πŸ§΅πŸ‘‡ Image
πŸ“Œ What is an expression?

β†’ Expression is the combination of operator, operand(value), and variable that produce new value.

πŸ‘€ c = a + b;

- a, b is a value, and + is an operator that produces and new value as a c variable.
πŸ“ŒWhat is an operator?

β†’ It is used to manipulate values.

πŸ‘€

+, -, *, etc
Read 10 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(