toha
0
Q:

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
4
const isBlack = false;const text = isBlack ? 'Yes, black!' : 'No, something else.';console.log(text);// "No, something else."
1

New to Communities?

Join the community