Curriculum
Course: JavaScript Basic
Login

Curriculum

JavaScript Basic

JSHome

0/216
Text lesson

Strict Mode

Strict Mode

All modern browsers support JavaScript’s “Strict Mode.”

You will learn more about how to use Strict Mode in a later chapter of this tutorial.

In “Strict Mode,” undeclared variables are not automatically treated as global.

Global Variables in HTML

In JavaScript, the global scope refers to the JavaScript environment.

In HTML, the global scope is represented by the window object.Global variables declared with the var keyword become properties of the window object.

Example

var carName = “Volvo”;
// code here can use window.carName

Global variables declared with the let keyword do not become properties of the window object.

Example

let carName = “Volvo”;
// code here can not use window.carName