Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

var isGoing = true;

var color = isGoing ? "green" : "red";


console.log(color);

var adult = true;


var preorder = true;

console.log("It costs $" + (adult ? "40.00" : "20.00") + " to attend the concert.
Pick up your tickets at the " + (preorder ? "will call" : "gate") + ".");

var a = false;
var b = true;

var check =
if a true
{ if b true
{then a & b }
else
{ just a }
}
else
if b true
{ then just b }
else
undef

( substituting.... if?true then ... for "?" , and ...else: ... for " : " )
var check = a if?true then (b if?true then "a & b true" else: "just a true") else:
(b if?true then"b true" else: undefined);

var eatsPlants = true;


var eatsAnimals = true;

var category = eatsPlants && eatsAnimals ? "omnivore" :


eatsPlants ? "herbivore":eatsAnimals ? "carnivore" : undefined;

console.log(category);

You might also like