javascript conditional

JavaScript
condition ? ifTrue : ifFalsecondition ? doThisIfTrue : doThisIfFalse

1 > 2 ? console.log(true) : console.log(false)
// returns false//ternary operator example:
var isOpen = true; //try changing isOpen to false
var welcomeMessage  = isOpen ? "We are open, come on in." : "Sorry, we are closed.";

var age=20;
if (age < 18) {
	console.log("underage");
} else {
	console.log("let em in!");
}if (x === 5 || x === 8)
  console.log("x is eaqual to 5 OR 8")// example:
age >= 18 ? `wine` : `water`;

// syntax:
// <expression> ? <value-if-true> : <value-if-false>
Source

Also in JavaScript: