JavaScript – Global, Function and Lexical scopes.

Scope is the set of variables you have access to. In JavaScript, scope is the set of variables, objects, and functions you have access to.

Global JavaScript Variables

A variable declared outside a function, becomes GLOBAL.

A global variable has global scope: All scripts and functions on a web page can access it.

var carName = ” Toyota”; Continue reading