Write program to Use a conditional (ternary) operator to check string value
If the variable firstName is equal to "John", the value of the variable result should be "Hello John!"
Otherwise the value of result should be "You're not John!".
var firstName = "John"; var result = // add code here console.log( result);
Syntax hint
(condition) ? value1:value2;
var firstName = "John"; var result = (firstName === "John") ? "Hello John!":"You're not John!"; console.log( result);/* w w w . j a v a 2 s . c o m*/ firstName = "Json"; var result = (firstName === "John") ? "Hello John!":"You're not John!"; console.log( result);