The 'while' loop/? about === and =


I know that === and = is different but fromt he examples below how come the second one won't work?

    slaying = false;

while(slaying === true){
     slaying === false;



The = is the so-called assignment operator
with which you assign a Value to a variable
slaying = false;

In Javascript you have 2 equality operators

  • the == is the so-called equality operator with =type conversion=
    • 0 == false gives a true
      "0" == 0 gives a true
  • the === the so-called strict equality operator
    the left and right argument must both be of the SAME data-type

    • 0 === false gives a false
      "0" === 0 gives a false

Nice to know

Possible data types

The **VALUE** can be anything from:

•Object  ◦Function