Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript loops

var test = 0;

type 1;

while (test < 10) {
  console.log(test)
	test = test++
}

/* while (condition) {
 our code
} */

return(
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9) to the from (instant) * 'in console'

type 2;
for (var n = 0;n < 10; n++) {
	console.log(n)
}

//note separate codes in for loops with ";"

/* for (Initial value before starting the loop;loop Condition;value after ending loop) {
  our code
} */


return(
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9) to the from (instant) * 'in console'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #loops
ADD COMMENT
Topic
Name
5+2 =