Comparision operators
JavaScript Comparison Operators
Comparison operators are used in logical statements to determine equality or difference between variables or values. They are used to test whether a condition is true or false
Repetition
Repetition, or Loops
There are several ways to execute a statement or block of statements repeatedly. In general, repetitive execution is called looping . It is typically controlled by a test of some variable, the value of which is changed each time the loop is executed. There are several types of loops: for loops, for...in loops, while loops, and do...while loops, each behaves slightly differently and it is up to the programmer to choose the most appropriate
Selection
Javascript selection (or conditional) statements
Selection, or decisions, are made in Javascript using the statement
if(condition) { //is true } else { //is false }
Simple if statements may be written as a single line, but when the true or false portions consist of multiple statements its more likely to be written as Window messages
Alert, prompt, and confirm message boxes (pop up windows)
Use alert, confirm, and prompt message boxes to obtain input from your user. The boxes are methods of the interface window object. Because the window object is at the top of the object hierarchy, you do not actually have to use the full name (for example, "window.alert()") of any of these message boxes, but it is a good idea to do so, because it helps you remember to which object they belong.
HTML form
Retrieving values from a web page
There are two main ways of getting information about the elements on a webpage. These are
- document.getElementById('element');
- document.getElementsByTagName('tagName');
The method getElementsByTagName('tagName'), gets a list of all child elements attached to the nodes with the specified tag name. It may appear to be an array, by it is actually an DOM NodeList object.

