reading-notes

Read: 05 - Operators and Loops

Comparison Operators:

Evaluate a situation by comparing one value in the script to what you expect it might be. The result will be a Boolean: True or false.


Logical Operators

The operators used to return the result of multiple comparison operators

**((5 < 12)   (8 >= 2))**

Loops

A loop is block of code that will keep running as long as the condition is true. The most common types of loops are:

** A for loop consists of variable initialization, condition, and update.

Example

Loop through the indices of an array to collect the car names from the cars array:

var cars = [“BMW”, “Volvo”, “Saab”, “Ford”]; v/ar text = “”; var i = 0; while (i < cars.length) { text += cars[i] + “
”; i++; }