This is down to changes that were made for new versions of ZPE.
Most programming languages feature conditions within them. JavaScript is no exception here.
A condition is a rule which must be met. For instance, a computer may only be switched on if the power switch is on at the wall. This is a simple condition.
Conditions play a huge part in programs as they very often dictate which way a program will run. They can create jumps between sections of code. This section of this tutorial will show several ways to control the flow of a JavaScript application using conditions.
In JavaScript a condition is typed as a boolean type. The simplest conditions are true
and false
, but more complex conditions also return these as results.
There are several operators that can be used:
Symbol  Name  Returns true when 

<  Less than 
a is less than b .

>  Greater than 
a is greater than b .

<=  Less than or equal to 
a is less than or equal to b .

>=  Greater than or equal to 
a is greater than or equal to b .

==  Equal to 
a is equal to b .

!=  Not equal to 
a is not equal to b .

===  Identical 
a and b are the same and are the same type.

!==  Not identical 
a and b are not the same or are not the same type.

These operators are easy to use:
var x = 5; var y = 7; var z = 0; z = x < y; alert(z); z = x > y; alert(z); z = x <= y; alert(z); z = x >= y; alert(z); z = x == y; alert(z); z = x != y; alert(z); z = x === y; alert(z); z = x !== y; alert(z);
Propositional logic which programming languages such as JavaScript use can also join multiple conditions through logical conjunction and logical disjunction. These are better known as AND and OR.
AND and OR are based on AND gates and OR gates in computer hardware.
AND requires that two conditions are true to return true.
The following is a truth table for AND:
P  Q  P AND Q 

true  true  true 
true  false  false 
false  true  false 
false  false  false 
In JavaScript the AND symbol is &&
. The following is an example using AND in a condition:
var r = false; p = true; q = false; r = true; result = p && q; alert(result); result = p && r; alert(result);
OR requires that one of the two conditions is true to return true.
The following is the truth table for OR:
P  Q  P OR Q 

true  true  true 
true  false  true 
false  true  true 
false  false  false 
In JavaScript the OR symbol is 
. The following is an example using OR in a condition:
var r = false; p = false; q = false; r = true; result = p  q; alert(result); result = p  r; alert(result);
The final type of logical operator is the NOT operator. The truth table following shows how NOT performs.
P  NOT P 

true  false 
false  true 
In JavaScript, NOT is represented with the !
operator. Putting a NOT operator in front of
a boolean value will invert it. The following is a condition that uses
the NOT operator to flip the value of a boolean value:
var x = false; var y = true; alert(!x); alert(!y);
A key law in logic is De Morgan's Law. This law shows:
Less formally:
!(A && B)
== !A  !B
!(A  B)
== !A && !B
The truth table for !(A && B)
and !A  !B
is as follows:
A  B  A && B  !(A && B)  !A  !B 

true  true  true  false  false 
true  false  false  true  true 
false  true  false  true  true 
false  false  false  true  true 
Now in JavaScript:
var A = true; var B = false; alert(!(A && B)); alert(!A  !B);
Now the truth table for !(A  B)
and !A && !B
is as follows:
A  B  A  B  !(A  B)  !A && !B 

true  true  true  false  false 
true  false  true  false  false 
false  true  true  false  false 
false  false  false  true  true 
Now in JavaScript:
var A = true; var B = false; alert(!(A  B)); alert(!A && !B);
S1s and S2s really enjoyed the lesson on cybercrime using the lesson on How to Rob A Bank on… https://t.co/MxjDYE2JFu 8 months ago 
S2s doing really well in hardware test! Also really enjoying doing tests electronically rather than on paper.… https://t.co/ritdfcW6Mw 8 months ago 
S1 and S2 pupils listing input and output devices and giving answers such as keyboard and mouse but there were also… https://t.co/dGxDkYqFxo 9 months ago 