Declaring javascript variables as specific types [closed]

Quite simply, JavaScript variables do not have types. The values have types.

The language permits us to write code like this:

var foo = 42;
foo = 'the answer';
foo = function () {};

So it would be pointless to specify the type in a variable declaration, because the type is dictated by the variable’s value. This fairly common in “dynamic” languages.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)