Ternary Operator
Video
JavaScript Notes
JavaScript
var first_name = "Ricky";
var last_name = "Bobby";
var age = 45;
var first = true;
var last = false;
var bob; //undefined
// TERNARY statement
// first part runs if true, second part runs if false
( first == last)? console.log("nope") : console.log("yep") ;
( first == last)? console.log("nope") : (age)? console.log("yep") : console.log ("no again");
Feedback
Submit and view feedback