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.

Boolean

Another important data type next to String and Number is Boolean. It has only two possible values: true and false. You can calculate with Boolean values similar to numbers. JavaScript has three Boolean operators: && (and), || (or) and ! (not). && links two Boolean values. If both values are true, the result is true. In all other cases it is false. With || the result is true, if at least one of the two input values is true. If both input values are false, the result is false. ! is applied to a single Boolean value and inverts this value: !true is false and !false is true.
var x1 = true && false;
var x2 = !x1;
var x3 = x1 || x2;
x1 is false, x2 is true and x3 is true.

Exercise

Write a function nand that takes two Boolean values. If both values are true, the result should be false. In the other cases the return should be true. The call nand(true, true) should return false. The calls nand(true, false), nand(false, true) and nand(false, false) should return true.
var nand = function(a, b) {
  var and = a && b;
  ...
};
var nand = function(a, b) {
  var and = a && b;
  return !and;
};