reading-notes

this repo will contain my reading during the course .

View project on GitHub

Comparison Operators :

Comparison operators are used in logical statements to determine equality or difference between variables or values.

the table below explains the comparison operators:

Operator. Description
== [Equal to]
=== [ equal value and equal type]
!= not equal
!== not equal value or not equal type
> greater than
< less than
>= greater than or equal to
<= less than or equal to

Logical Operators

** Logical operators are used to determine the logic between variables or values.**

Operator. Description
&& [and]
ll [ or]
! not

loops

Loops are handy, if you want to run the same code over and over again, each time with a different value.

Different Kinds of Loops :

JavaScript supports different kinds of loops:

  • for - loops through a block of code a number of times
  • for/in - loops through the properties of an object
  • for/of - loops through the values of an iterable object
  • while - loops through a block of code while a specified condition is true
  • do/while - also loops through a block of code while a specified condition is true

1. The For Loop

The for loop has the following syntax:

for (statement 1; statement 2; statement 3) { // code block to be executed }

  • Statement 1 is executed (one time) before the execution of the code block.

  • Statement 2 defines the condition for executing the code block.

  • Statement 3 is executed (every time) after the code block has been executed.

iii

2. While Loops

The while loop loops through a block of code as long as a specified condition is true.

Syntax while (condition) { // code block to be executed }

img