In javascript, if statements are a little different

if (condition) {
    //code
} else if (condition 2) {
    //code
} else {
    //code
}
for (let i = number; i < number; i++) {
    // code
}

Conditions and booleans can be equivalent.

sunny = true; 
rainy = false;

if (sunny) {
    umbrella = false; 
} else if (rainy) {
    umbrella = true; 
} else {
    umbrella = false; 
}
console.log(umbrella);

umbrella = !sunny && rainy;
console.log(umbrella);
list = [1, 2, 3, 4, 5]

for n in list:
    if n == 3:
        print("3!")
        break
    else:
        print("no")
no
no
3!

Binary search works by checking the middle value in a sorted list and cutting of the half greater or less than the middle based on the desired value.

Find 1 [1, 2, 3, 4, 5, 6, 7] 4 is the middle. 4 > 1 [1, 2, 3] 2 is the middle. 2 > 1 [1]