Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
199
rated 0 times [  200] [ 1]  / answers: 1 / hits: 25520  / 13 Years ago, sun, march 11, 2012, 12:00:00

Is there any way to use typed variables in javascript? Like integer, string, float...


More From » javascript

 Answers
32

JavaScript variables are not typed.



JavaScript values are, though. The same variable can change (be assigned a new value), for example, from uninitialized to number to boolean to string (not that you'd want to do this!):



var x;       // undefined
x = 0; // number
x = true; // boolean
x = hello; // string

[#86915] Friday, March 9, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
georginaariao

Total Points: 626
Total Questions: 112
Total Answers: 112

Location: Burkina Faso
Member since Thu, Dec 15, 2022
2 Years ago
;