javascript if true code example
Example 1: check if javascript function is true
function example(){
return true;
}
if(example()){
console.log('hello');
}else{
console.log('bye');
}
// result: 'hello'
Example 2: single if statement js true false
condition ? exprIfTrue : exprIfFalse
Example 3: boolean
bool x = true;
if (x) { print ("Hello") }