reading-notes

Loops and Logic

What is an expression in JavaScript?

An expression is code that gives a value. it is either asssigned or evaluated. x = 7 3 + 4 = 7

Why would we use a loop in our code?

You use loops when you want to repeat afunction multiple times.

The reading for lopos gives the example of naming the diferent music types. So the user asks the loop to keep adding musicTypes to all ‘optioms”

When does a ‘for’ loop stop executing?

The loop repates until the conditions are specified to be false. In the example of naming the diferent music types, the loop would end when the options stop being labeled as options.

How many times will a ‘while’ loop execute?

As long as the conditions are true.