caydennnnn5074 caydennnnn5074
  • 13-05-2020
  • Computers and Technology
contestada

In a For loop the programmer must know the exact number of iterations the loop

must perform before writing the code.

True

False

Respuesta :

motojack500
motojack500 motojack500
  • 13-05-2020

False

while in many cases a for loop might loop through a preset amount of data the number of iterations can also be stored in a dynamic variable

Preset

for(var i = 0; i < 50; i++){

console.log(i);

}

/*returns

1

2

3

4

5

etc it keeps going until 50

*/

Dynamic

// array size can be changed and still work

var arr = ["a","b","c"];

for(var x = 0; x< arr.length; x++){

console.log(arr[x])

}

/*returns

"a"

"b"

"c"

*/

Answer Link

Otras preguntas

how is mass transit in cities a possible solution tk urban air pollution?
Find Domain of the functionsquare root of (x-8)/x(x-9)
How is it possible for Mercury to have frozen ice ?
how is mass transit in cities a possible solution tk urban air pollution?
How is it possible for Mercury to have frozen ice ?
Prove that (x^5)-(x^2)+2x +3=0 has at least one real root. Prove that x=cosx has at least one solution.
Historians of china have traditionally dated the beginning of Chinese civilization to the founding of the what??
Historians of china have traditionally dated the beginning of Chinese civilization to the founding of the what??
how is mass transit in cities a possible solution tk urban air pollution?
How is it possible for Mercury to have frozen ice ?