freeCodeCamp/guide/english/javascript/loops/index.md

15 lines
855 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Loops
---
Loops are used in JavaScript to perform repeated tasks based on a condition. Conditions typically return `true` or `false` when analysed. A loop will continue running until the defined condition returns `false`.
There are three common types of loops:
* <a href='http://forum.freecodecamp.com/t/javascript-for-loop/14666' target='_blank' rel='nofollow'>for</a>
* <a href='http://forum.freecodecamp.com/t/javascript-while-loop/14668' target='_blank' rel='nofollow'>while</a>
* <a href='http://forum.freecodecamp.com/t/javascript-for-loop/14662' target='_blank' rel='nofollow'>do while</a>
You can type `js for`, `js while` or `js do while` to get more info on any of these.
> Links: <a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for' target='_blank' rel='nofollow'>MDN **for loop**</a>