Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript question mark

//This is what is called a 'Conditional operator'
let result = condition ? value1 : value2
//               ^^        ^^      ^^
let result =  1 == 2   ?  "YES" : "NO!"
console.log(result)  //output: "NO!"

//Basically a short form of an if-else statment
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #question #mark
ADD COMMENT
Topic
Name
5+5 =