Ternary Operators: An Introduction to the Alternative Conditional Operator in JavaScript

preview_player
Показать описание
Just like JavaScript's if/else and switch statements, ternary operators allow developers to introduce conditional logic in their applications.

The one major difference between if/else statements and ternary operators is that the ternary operator returns an expression (or value) while the if/else statement performs actions (executes code) inside each block.

I'll walk through the idea of statements vs expressions in-depth. On top of that, I'll explain why it's beneficial to consider incorporating the operator in your applications.

Timestamps:
0:00 Intro
0:38 Ternary Operator Syntax
1:12 From if/else to Ternary
2:43 Ternary Expressions vs if/else Statements
4:01 Examples of How to Use Ternary Operator
5:58 Ternary Operator Chaining
7:23 Common, Real-World Uses of Ternary Operators

== Let's Connect ==

== Who I Am ==
I'm Ijemma, a frontend software engineer currently working in New York City. I make videos on all things JavaScript and, more broadly, frontend web development.

#javascript #webdevelopment #softwareengineer
Рекомендации по теме
Комментарии
Автор

I don’t even know JavaScript, but I really enjoyed this video! You are a great teacher!

Bukola
Автор

You are very quickly becoming my favorite YT channel for help. The way you break things down makes things click everytime for me. 🙌🏼

BADLEMONART
Автор

Seriously... i really need a mentor like you.... Well simplified... You just made it so simple.... thanks a lot

smileself
Автор

My second fav front end developer u don't wanna know the first 😊😊 supping 🙌🙌👊👊

ifyugwumba
Автор

Love ternary operators! I don't know if this works in JS, but in C++ for example you can also beef out your use of ternary operators with commas in the expressions, at the expense of readability.

ClydeHobart
Автор

Thanks for this. As a newbie i only ran into this while learning react. Didn't crop up in my js courses.

Makes more sense here.

What concept or way of working took your js knowledge to the next level? From say a newbie to mid level?

Thanks

calvint
visit shbcf.ru