01. Control flow

Control flow allows you to direct the flow of code depending on the conditions which are given. Here are the main operators used in comparison evaluations.

Comparison operators

Less than.
Greater than.
Greater than or equal to.
Less than or equal to.
4 > 10   // false
'hi' > 'hello'    // true, checks if greater alphabetically
4 >= 3   // true


Equal to - doesn't have to be the same type.
Strict equal to - must be the same type.
Not equal to.

The difference between the first two conditionals can be show by a simple example:

3 == '3' // true
3 === '3' // false, must be of same type
3 != 3    // false

Logical operators

The logical operators AND or OR allow you to group two evaluations together. An AND evaluates to true only if both sides of the expression are true, while an OR evaluates to true if either side is true.

To get the opposite of an evaluation, use the exclamation mark (!). This will turn a false into true and vice versa.

AND operator
OR operators
NOT operator
!true;            // false
! (3 > 3)         // true
4 < 3 && 2 < 5;   // true
true || false     // true

Aching back from coding all day?

Self-Massage Tool

Aching back from coding all day? Try Back Problems

Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.

$ Check price
29.9529.95Amazon 4.5 logo(3,443+ reviews)

More Back Problems resources

Build modern and responsive webpages

The Modern Web

Build modern and responsive webpages Try Front-end

The Modern Web will guide you through the most important tools of device-agnostic web development, including HTML5, CSS3, and JavaScript. The plain-english explanations and practical examples emphasize the techniques, principles, and practices that you'll need to easily transcend individual browser quirks and stay relevant as these technologies are updated.

$ Check price
34.9534.95Amazon 4.5 logo(30+ reviews)

More Front-end resources