JavaScript TERNARY OPERATOR in 6 minutes! ❓

preview_player
Показать описание
00:00:00 intro
00:00:32 example 1
00:02:37 example 2
00:03:36 example 3
00:04:30 example 4
Рекомендации по теме
Комментарии
Автор

// ternary operator = a shortcut to if{} and else{} statements
// helps to assign a variable based on a condition
// condition ? codeIfTrue : codeIfFalse;

let time = 9;
let greeting = time < 12 ? "Good morning!" : "Good afternoon!";
console.log(greeting);

let isStudent = false;
let message = isStudent ? "You are a student" : "You are NOT a student";
console.log(message);

let purchaseAmount = 99;
let discount = purchaseAmount >= 100 ? 10 : 0;
console.log(`Your total is $${purchaseAmount - purchaseAmount * (discount/100)}`);

BroCodez
Автор

I got my first job today in programming thanks to your free courses. Love you bro!

nikkehtine
Автор

This course im taking is missing a lesson on ternary operators... came here. you're a much better teacher. Subbing and checking out more videos. THANKS!

SaintWebby
Автор

bro’s better than all of the bootcamps combined somehow

Haryad-nhkc
Автор

<*_> This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal. <_*>

piotrmazgaj
Автор

Your videos are very helpful and your teaching style is superb. Thanks bro👊🏽

kevinmosala
Автор

Have an exam soon and you are saving my life. Thank you so much bro <3

isabsr
Автор

Thanks, bro. You're a real bro 💪

helioobianchi
Автор

Your code visible problem .so, your code editor must be zoom .

nazmullotus
Автор

Legends never die, ofcourse "BroCode" dont die

TheStRaX_