Do not confuse the equality operator (= =) with the assignment operator (=).
If the first of the two conditions separated by the && operator is false, the second condition is not detected as true or false. With this, you can increase the speed of your scripts.
Use multiple conditions with a switch
if (button== "Next") window.location = "next.html"; else if (button== "previous") window.location = "pre.html"; else if (button== "Home") window.location = "home.html"; else if (button== "back") window.location = "back.html"; Switch (Button) {case "next": window.location = "next.html"; break; Case "Previous": window.location = "pre.html"; break; Case "Home": window.location = "home.html"; break; Case "Back": window.location = "back.html"; break; }
You can use multiple statements after each case statement in the switch structure. You don't have to put them in curly braces. If case matches, the JavaScript resolver executes the statement until it encounters a break (or the next).
JavaScript also has a third type of loop. For....in Loop, he is specifically used to perform operations on an object's properties
For (i-navigator) { document.write ("property:" + i); document.write ("Value:" + navigator[i] + "<br>"); }
Like the normal for loop, this type of loop also uses an index variable. In each iteration of the loop, the variable is set to the next property of the object. This makes it easy to examine and modify each property of an object.