Ternary Operator - Beau teaches JavaScript

preview_player
Показать описание
The ternary operator, or conditional operator, takes three arguments and is basically a shortened way of writing an if-else statement.

Code:

More info:

⭐JavaScript Playlists⭐

-
We're busy people who learn to code, then practice by building projects for nonprofits. Learn Full-stack JavaScript, build a portfolio, and get great references with our open source community.

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

I love the ternary operator.
Here's FizzBuzz:

for (let i = 1; i < 101; i++) {
let sound = i % 15 === 0 ?
'fizzbuzz' : i % 5 === 0 ?
'buzz' : i % 3 === 0 ?
'fizz' : i;
console.log(sound)
}

coolworx
Автор

I am using Codecademy Pro and this was a bit confusing in the lesson. This video explains it absolutely perfect. I understand the syntax and how it works. Thank you!

darnellg
Автор

Can you do a lesson on how you type so fast! Holy moly! :) Great vid.

RealToughCandy
Автор

I had a ternary operator quiz that was embedded in another ternary operator and couldn't figure out what was happening. Until I met Beau. Thanks a lot.

martinmuthie
Автор

You are a god damn WIZARD!!! Loving your vids.

lenonlong
Автор

Interesting how you can assign a value to the variable in the ternary operator without having to use a semi colon. Can just one semicolon for the ternary itself, def learned something today. Thanks man

juicetheballer
Автор

Great explanation. It's hard to understand from start, but with ternary operator you can write code in more organized way.

MemasMaklas
Автор

in 4 minutes you explained everything. wooow Thank you

nooneknows
Автор

anyone else freaked out at how quickly he typed "You are an adult" and "You are a kid"?

BonesMuhroni
Автор

Thank you for this video, It helped me pass a test.

eammyuwe
Автор

Bro was flexing on us with his fast typing.

jeffbasos
Автор

can anyone tell what is meant by three operand ?

heyman
Автор

what is the difference between ternary operator and if/else statement? which one is faster, suitable and apprioripate in which situation?? can you explain. thank you in advance.

akhelikancha
Автор

Nested ternaries are wak yo. At that point we should be looking at switch statements. Right? Still learning...

Human_Evolution-
Автор

nice video what if firstcheck = true and secondcheck = true please explain

mohammedabosetta
Автор

1k likes baby i feel honored love you fcc

BlackDev
Автор

why fcc videos so little views? should have at least 50k views in my book

lycan