+ 1

Can anyone tell me that the datatype "var" is only for integers or for other types too?

Can anyone tell me that the datatype "var" is only for integers or for other types too?

31st Dec 2020, 6:24 AM
Atul [Inactive]
4 Antworten
+ 3
for everything var x = "string"; //string var x = 12; //int var x = 12.5;//float var x = true;//boolean(true or false)
31st Dec 2020, 6:37 AM
maydrt
maydrt - avatar
+ 2
Atul Panda It's for everything.
31st Dec 2020, 6:28 AM
A͢J
A͢J - avatar
+ 2
var can be used to assign any data type and also you can change it in future For example var a = " Strong" a = 4 a = 4.75 a = true a = null a = false console.log(a) ; Output : false You won't get any error
31st Dec 2020, 6:30 AM
Krish
Krish - avatar
+ 2
Thank You
31st Dec 2020, 6:32 AM
Atul [Inactive]