Add an else statement to display "You're not John!".
var firstName = "Json"; if (firstName === "John") { console.log( "Hello John!" ); }//your code here
if (condition) { block of code to be executed if the condition is true } else { block of code to be executed if the condition is false }
var firstName = "Json"; if (firstName === "John") { console.log( "Hello John!"); } else {/*from w ww . j av a 2 s.c om*/ console.log( "You're not John!" ); }