From the course: JavaScript Essential Training

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Var

Var

- [Instructor] In this chapter, we'll take a step back and look at some fundamentals of JavaScript including variables, data types, and various operators. For this purpose, have created the most basic of exercise files, a blank HTML document calling in a single JavaScript file. This gives us a good playground to experiment in the console. We'll start with variables. The classic variable container in JavaScript is simply called var, and it's defined with the var statement. You assign a value to a var by giving it first a name then using the assignment symbol, the equal symbol and then adding a value to it. In the console, I can create a new var by saying var, and then give it a name, container, and then use the equal symbol to assign a value to it. So I'll assign it to value of five. Now I can call in the container at any time and when I do, I get the value. So, five. So I can say container and the browser will…

Contents