JavaScript supports the notion of weak typing.
JavaScript supports the notion of weak typing, or dynamic typing. This means that the type of a variable is inferred from the data it contains. This is why there is only one way to declare variables- by using the
var keyword.
var v = "Some String Data";
alert(typeof v);
v = 5;
alert(typeof v);
In above first instance, a message box will be displayed showing that the type of v is a string. In the second
instance, the type of v is a number. The type of the v variable has been inferred, and in fact changed, according to what type of data it contains.