+ 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 ?

28th Jun 2017, 6:58 AM
gobiga rani
gobiga rani - avatar
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
28th Jun 2017, 7:02 AM
Hatsy Rei
Hatsy Rei - avatar
0
Javascript recognises the variable data type from the input data, so we don't have to declare it.
28th Jun 2017, 8:48 AM
Calviղ
Calviղ - avatar