JavaScript data type boolean example

//Simple JS if statement

if (boolean condition) {
    //if boolean condition is true execute this part of code
} else {
    //if boolean condition is false (not true) execute this part of code
}

for (control statement; boolean condition; incrementer) {
    //only when boolean is met, this part of code will be executed
}

while (boolean condition) {
    //while condition is met, this part of code will be executed
}

//


/**
 * Let's set value to false
 * */
let value = false;

/**
 * If value is false (non-existent, binary 0, not true) set value to true,
 * otherwise se it to true
 * */
 
if (value === false) {
    value = true;
} else {
    value = false;
}

for (let i = 0; i < 10; i++) {
    //(For as long as condition is true), 
    //So as long as i is less than 10, this code will be executed
}

while (i < 10) {
    //while i is less than 10, this code will be executed
    //(While condition is true, this code will be executed)
}