Skip to content
Onsite

Output: calling a function declaration and a var function expression before their definitions

EasyP1Output

What does this code print?

1console.log(declared());
2function declared() {
3 return 'declared ran';
4}
5
6console.log(typeof expression);
7expression();
8var expression = function () {
9 return 'expression ran';
10};
Saved automatically

One line per console.log. Arrays as [1, 2, 3], objects as { a: 1 }, an uncaught error as Uncaught TypeError: message (Chrome and Node wording).

Hints

Saved automatically