+ 1
doubt
var x=42; var name='abc' var text="abc is an alphabet " in this all the values are stored as a same data type ...is there any problem will arise when we call it as a var ?
2 ответов
+ 8
In accordance to Microsoft,
"JavaScript is a loosely typed language, which means you do not declare the data types of variables explicitly. In many cases JavaScript performs conversions automatically when they are needed. For example, if you add a number to an item that consists of text (a string), the number is converted to text."
https://docs.microsoft.com/en-us/scripting/javascript/javascript-fundamentals
0
Javascript recognises the variable data type from the input data, so we don't have to declare it.