js one line ifs code example
Example 1: js if else statement one line
var time = Date().getHours(); // or something
var clockTime = time > 12 ? 'PM' : 'AM' ;
Example 2: javascript one line if else
var res = 1 == 1 ? 'true' : 'false' // res = true
var res = 1 == 2 ? 'true' : 'false' // res = false