Scoping in JavaScript: The Basicsby@sambernheim
949 reads

Scoping in JavaScript: The Basics

tldt arrow
Read on Terminal Reader🖨️

Too Long; Didn't Read

The goal is to understand the difference between lexical and block scoping. Lexical scoping allows for the redefining of variables that are lexically scoped. Block scoped variables only exist through the use of a variable variable when declared. In contrast, lexical variables can be redeclared. In the second function, the first function will throw an error that the variable cannot be redoared. This is due to the fact that in this case, the variable variable was created with an even an even though the variable is redoed.
featured image - Scoping in JavaScript: The Basics
Sam Bernheim HackerNoon profile picture

@sambernheim

Sam Bernheim

Learn More
LEARN MORE ABOUT @SAMBERNHEIM'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa