+ 12
Do you need to declare variable data type in js?
This question was in challenge and answer was "no". WHY??? If you wont define a type you cant use it... Edit: Oh I was cheated, I do not use it, so it do not have to be declared!
10 Respuestas
+ 5
JavaScript is a loosely typed language, meaning you don't have to declare the data type when declaring a variable, as you might with other languages. A variable can hold any type of data without being specified.
Here's an article you might find useful that goes into more detail:
https://medium.com/@xiaoyunyang/javascript-is-a-loosely-typed-language-meaning-you-dont-have-to-specify-what-type-of-information-137408d54fc7
+ 5
I think they use the term dynamically typed for languages where you don't have to declare the variable type.
+ 3
Variable are dynamically allocated. So there are no data types such as Float, Double etc but in js there is string, number, Boolean.
To declare a variable you just use the keyword var or let and the program will decipher if the value is a string or number or boolean on its own.
+ 1
No, you don't need to declare variable type in js, it's dynamically determined.
+ 1
No but in emascript 6 I wonder where using the keyword Const is not geering towards that?... after second thought, it's something different, const is not a data type as such.
+ 1
No, js can detect the data type itself
+ 1
There is no data type
0
хуй знает
0
variable in js can contain any data type. there is no need to declare them