Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to make one line if in js

// If statement
// if (condition) //code
if (5 > 3) return "Is greater"; // "Is greater"

// If else statement
// (condition) ? if : else
let res = (1 > 3) ? "is greater" : "is less than";// "is less than"
 
PREVIOUS NEXT
Tagged: #line #js
ADD COMMENT
Topic
Name
2+9 =