The browser storage localStorage is not available. Either your browser does not support it or you have disabled it or the maximum memory size is exceeded. Without localStorage your solutions will not be stored.
Compare numbers
Numbers can be compared with the well-known mathematical symbols.
In the following examples, all expressions return the value
true
.
let v1 = 5 > 4;
let v2 = 5 >= 5;
let v3 = 5 < 6;
let v4 = 5 <= 5;
Exercise
Write a function
Example:
isThreeDigit
that checks if a number is greater than
or equal to 100 and less than 1000.Example:
isThreeDigit(500)
should return true
and isThreeDigit(50)
should return false
.
+ Hint
function isThreeDigit(x) {
return x >= 100 && ...
}
+ Solution
function isThreeDigit(x) {
return x >= 100 && x < 1000;
}