Javascript - What is the output: default parameter and dynamic function?

Question

What is the output of the following code?

var getNumber = new Function("number = 42", "return number;"); 
console.log(getNumber()); 


Click to view the answer

42

Note

The default parameters in ES6 is the fact that they work even when creating a dynamic function.

Related Quiz