Skip to content

Latest commit

 

History

History
18 lines (18 loc) · 1.73 KB

File metadata and controls

18 lines (18 loc) · 1.73 KB

On pages 150,151,156 and 157: there are some of comparison operators, and the result will be a Boolean: true or false. == is equal to: This operator compare two values to see if they are the same. != is not equal to: This operator compares two values to see if they are not the same. === strict equal to: this operator check that both the data type and value are the same. !== strict not equal to: this operator check that both the data tyre and value are not the same. (>) greater than :this operator checks if the number on the left is greater than the number on the right. < less thaan: this operator checks if the number on the left is less than the number on the right. (>=) greater than or equal to: this operator checks if the number on the left is greater than or equal to the number on the right. <= less than or equal to: this operator checks if the number on the left is less than or equal to the number on the right. Logical operators allow you to compare the results of more than one comparison operator. && Logical and : This operator tests more than one condition. || Logical or : this operator tests at least one condition. ! Logical not: this operator takes a single Boolean value and inverts it. On pages 170-173 and 176: Loops check a condition, it repeats until the condition returns false. There are three common types of loops:

  • For: if you need to run code a specific number of times.
  • While : if you don't know how many times the code should run. A for loop uses a counter as a condition. The condition consists of three statements, initialization [create a variable set it to 0. (var i = 0;)], condition [ the loop should continue to run until the counter reaches a specific number (i<x;)], and update [ it adds one to the counter (i++)].