There are two types of language.One is statically typed and another one is Dynamically typed. In statically typed languages(ex. c,cpp,Java) we have to specify the type of the variable during declaration of a variable. In Dynamically typed language we dont have to specify the type of datatype.We just declared it and use it.It automatically converts the declared variable into that type.
There are 3 variable declaration types in JavaScript. 1)var,2) let,3)Const
var is obsoluted variable declaration in JS. Basically it has function scope or global scope. Redeclaration is allowed in same scope.
Variable type let having many similarities of var but the main diffrence between let and var is that var is function scoped whereas let is block scoped. Redeclaration is not possible in same scope.
Const declared variable value can't be changed.It is similar as const in c/cpp only. Redeclaration and updation is not possible in same scope. It is also have block scope. In const we have to initialize value during declaration only.
Strings are collections of alpha-numeric characters and symbols. By using this we can store letter and words in JavaScript. Boolean only have 2 values.Either true or false.It is quite useful in conditional statements and also in loops. Numbers are numbers only.They include both integers and decimals. We use numbers in JS often to do mathematical operations. Undefined data type means that the variable has never been initialized. Null also similar to undefined but it has to be intentionally set. Both undefined and Null means empty or nothing.
The other common data types are Arrays and Objects. Arrays is just like list of elements or a container for a list of data. Array can store different datatypes even objects also.
In the other hand Objects are like dictionary or combination of key,value pair. We can directly access the value by the key elements.
To determine the datatype of a variable we often use typeof operator in JavaScript.
0, null, undefined, '', NaN are considered as a falsy value. In boolean operations these will always give false. Except others are considered as Truthy values. So as an example {},[] will give true value.