Variables in JavaScript are like, over 9000 times easier than other languages. (Do you get it?) Most languages have separate variables like int, string, and double. But JavaScript only has one. This one variable can hold all kinds of variables, so woo, your lucky!
Variables are used in every script, so make sure you pay attention!
Your variable can have any name you want, except you can't start the variable name with a number
var variableName = 3;
This makes a variables with the name 'variableName', and sets the data for the variable to 3. To make sure that your script works, after that line, then you can write either Alert(variableName);
If you wrote this correctly, you should get a pop up that has the number 3, or whatever number you put.
The variable name can be anything you want it to be, I used to make that mistake on my first program, but then I had to figure that out too.
- On other note
Alert is a built in function that creates a pop up that will print text onto an alert that the reader can use. Please do not use alerts to spam someone or create an inbuilt advertisement. I am not taking responsibility for what you write and do with these!
DU LIEST GERADE
JavaScript for Newbies
SachbücherThis is a step by step tutorial book on how to program in JavaScript. From beginner to Expert!
