reading-notes

reading notes #8

Expressions, Operators, and loops

  1. What is an expression in JavaScript?

    In JavaScript, an expression is a combination of values, variables, and operators that produces a single value. Think of it as a small instruction that tells the computer to perform a specific calculation. Expressions can be simple, like 5 + 3, or more complex, involving variables and functions.

  2. Why would we use a loop in our code?

    We use loops in our code to repeat tasks or actions multiple times. They are like virtual assistants that follow instructions to do something over and over again. This is useful when we want to work with a list of items or perform the same task until a certain condition is met.

  3. When does a for loop stop executing?

    A for loop stops executing when the condition specified in the loop header is no longer true. For example, if you have a for loop that counts from 1 to 10, it will stop executing when the loop variable (usually i) reaches a value where the condition i <= 10 is no longer true.

  4. How many times will a while loop execute?

    A while loop continues to execute as long as the condition specified in the loop header remains true. The number of times a while loop executes depends on the condition you set. It will keep running until the condition becomes false.

</head>

10/12 3pm