Javascript Function Argument Passing Question 4

Introduction

What is the output of the following code?


function greet(name) {
    console.log("Hello " + name);
}

greet("aaa");//from   w  w  w. ja v  a 2  s  . c  o  m
greet();
greet(undefined);
greet(null);
greet(false);


Hello aaa
Hello undefined
Hello undefined
Hello null
Hello false

Note

Javascript allows functions to be called without parameters even though the function expects them.




PreviousNext

Related