JavaScript variables do not have types. The values have types. Here’s how JavaScript variables are declared −
var rank = 5 var name =”John”
You can still write it like this −
var rank = 5 rank = ‘first' document.write(rank)
As you can see above, it wouldn’t be of any benefit to specify the type in a variable declaration. This is because the type is dictated by the variable's value.