javascript write if in a line code example
Example 1: inline if else javascript
var a = 2;
var b = 3;
var c = ((a < b) ? 'minor' : 'major');
Example 2: one line if statement javascript
if (lemons) document.write("foo gave me a bar");
var a = 2;
var b = 3;
var c = ((a < b) ? 'minor' : 'major');
if (lemons) document.write("foo gave me a bar");