DEV Community

Nandhini
Nandhini

Posted on

JavaScript "Variables"

Hi all, I learned about variables in JavaScript recently.
Variables are containers which used to store data.

It can be declared in 4 ways.

  • Using let e.g.,
let x=2;
let y=3;
let z=x+y;
Enter fullscreen mode Exit fullscreen mode
  • Using Const e.g.,
const x=3;
const y=4;
const z=x*y;
Enter fullscreen mode Exit fullscreen mode
  • Using Var e.g.,
var a=1;
var b=1;
var c=a-b;

Enter fullscreen mode Exit fullscreen mode
  • Automatically
a=10;
b=5;
c=a-b;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)