There are 3 main types of variables.
String: A string is a variable that holds text. To create a string, you will have to do type,
var string1 = "This is the text in the string";
Integer: An integer is a whole number with no decimals, can be easily used in mathematical equations.
var int2 = 24;
Float: A float is a number like the integer, but will have a decimal. Say you have a float you want to have the value of 20, the value of the float will be 20.0 Because it will have to have the decimal.
var float3 = 12.1122;- Another note:
Another way to know if you have the right code, you can do, console.log(varName);
VarName is the variable name, like the float I created earlier, float3. Then you open your console, then there your text will be.
YOU ARE READING
JavaScript for Newbies
Non-FictionThis is a step by step tutorial book on how to program in JavaScript. From beginner to Expert!