Javascript

JavaScript Variables

Keywords & Reserved Words JavaScript Const   A JavaScript variable is a storage for the data, where programs can store value or information. We must give a name to the variable. We can then refer to the variable in another part of the program. In this article, we learn how to declare a variable. Also, […]

JavaScript Variables Read More »

JavaScript Identifiers

Syntax & Rules Keywords & Reserved Words   JavaScript identifiers are the name that we give to variables, objects, functions, arrays, classes, etc. We must use a unique name so as to identify them. We then use the identifier to refer to the variable, functions, etc elsewhere in the program. There are certain rules &

JavaScript Identifiers Read More »

Lexical Scope & Closures in JavaScript

JavaScript uses the Lexical Scope to resolve the variable names when we create functions inside another function. The lexical means that JavaScript determines the parent scope of a function by looking at where we created the function and not where we invoked it. But JavaScript allows passing a function around, which means we may invoke them in a different scope than the original scope. Hence losing the connection to its parent scope. JavaScript solves this problem by creating Closures. A Closure contains function along with reference to its parent scope allowing the function to stay connected with its parent scope.

Lexical Scope & Closures in JavaScript Read More »

Scroll to Top