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

A group of farmers bought 28 tractors and trucks. There were 1.8 times more tractors than trucks. How many tractors and how many trucks were bought by the farme
What is the molecular weight of one mole of H2O? 18 g/moles 18.06 17.008
How did Battle of Tippecanoe contribute to the War of 1812?
On a pay stub what is the difference between net pay and ytd net pay
What fraction of his classmates have dogs? Explain step by step hurry
Nami conducts an investigation on plants. She places a grow light on a timer to give the plants different amounts of light to see if this would affect their gro
Approximately what percentage of individuals who tried dieting regain the weight within two years or less?
What was core and what were some of its factics
What provides access to the Internet; may also be internal.
Describe a positive effect and a negative effect the changes can have on an ecosystem