W 3 S y l l a b u s

Loading

Welcome to

W3Syllabus

shapeshapeshapeshapeshapeshape

JavaScript Variables

By W3Syllabus.com
icon Front-End Development
3 Views

Variables are Storing Data Container

JS Variable can be declared in 4 ways :

  1. Automatically
  2. Using var
  3. Using let
  4. Using const

Note :

It is considered good programing practice to write always declare variables before use.

The var keyword was used in all JavaScipt code from 1995 – 2015.

The let and const keywords were added to JavaScript in 2015.

The var keyword should only be used in code written for older browsers.

When to use var, let and const?

  1. Always declare variables.
  2. Always use const if the value should not be changed
  3. Always use const if the typw should not be changed (array and objects).
  4. Only use let if you can’t use const
  5. Only use var if you Must support old brwosers.

 

Courses You May Like

shape
shape
shape
shape
Newsletter

Subscribe Our Newsletter

thumb
thumb
+15k

More than 15k active users!

Join them now