Javascript - Write program to Add an else statement to if.

Requirements

Add an else statement to display "You're not John!".

var firstName = "Json";

if (firstName === "John") {
    console.log( "Hello John!" );
}//your code here

Hint

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
}

Demo

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!" );
}

Result