-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Description
let phrase = "Hello";
if (true) {
let user = "John";
function sayHi() {
alert(`${phrase}, ${user}`);
}
}
sayHi();The result is an error.
The function sayHi is declared inside the if, so it only lives inside it. There is no sayHi outside.
When I execute the code I don't get any error unless in strict mode, I think it can be a good idea to remind others that in order to see the error we need to add `'use strict';' at the top of our code
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels