What is a variable ??

Variables are a fundamental concept of any Programming language in the world, But what actually is a variable??? . We can say a variable is similitude to a container, where a value can be stored for recurrent use.

How to declare a variable in JavaScript

A variable is simply declared using the var keyword , followed by the variable name, one which a value is to be assigned, using the assignment operator = . See comprehensive example below.

var firstName = "Neymar" ;
⬇️.       ⬇️.        ↘️ *Value* 
*keyword*. ***Variable name***
console result 
// Neymar

At this juncture, it is pertinent to talk about data Types in JavaScript.

What are data types???

Data types simply are the different ways in which values to be assigned to a variable (container) are denoted or regarded, owing to programming languages convention.

Data types in JavaScript

There are 5 basic ways in which data are regarded in JavaScript, namely;

  1. Number

  2. String

  3. Boolean

  4. Undefined

  5. Null.

    Attached below is a descriptive slide on Primitive(non-object) data types in JavaScript.


NB : Javascript has a feature called dynamic typing i.e Data types are automatically assigned to variables ( JS spontaneously figures out if a value is a string, Number , Boolean, etc immediately it is assigned).