+ 2
Please guys how do I get to master JavaScript variables?
I get really confused applying them
3 Antworten
+ 5
Javascript variables are easy actually, because you don't need to declare them with their data type. They can be of any data type you want them to be. All you need to really know is what your naming convention will be. Like name the variable something relating to what it stores, else it's going to be confusing.
Example (Javascript):
var name;
name="Gavin";
alert(name);
name=26;
alert(name);
name=1.82;
alert(name);
name=true;
name?alert("true"):alert("false");
//Try this code out
//Only name="Gavin" makes sense, the others don't.
+ 2
thanks for the advice hehe
- 2
Well I think with time we'll get to know... Veterans here please contribute.