Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JavaScript Loops
- Loops are handy, if you want to run the same code over and over again, each time with a different value.
- Often this is the case when working with arrays:
- Instead of writing:
- text += cars[0] + "<br>";
- text += cars[1] + "<br>";
- text += cars[2] + "<br>";
- text += cars[3] + "<br>";
- text += cars[4] + "<br>";
- text += cars[5] + "<br>";
- You can write:
- for (i = 0; i < cars.length; i++) {
- text += cars[i] + "<br>";
- }
- download file on mediafire http://ow.ly/QbeG309bTYJ
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement