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.

Functions

A function is a block of statements that can be executed as often as you like. A function can have parameters and can return a value. Functions are defined by the keyword function, followed by the parameters enclosed in parentheses, followed by the instructions enclosed in curly brackets. Use the keyword return to return a value. At the same time return terminates the function. Functions can be assigned to a variable. With
var color = function() {
  return 'red';
};
we define a function that returns the value 'red'. The function has no parameters (the parentheses are empty) and contains only the return statement. The function is assigned to the variable color. The function is called via this variable:
var result = color();
Now the function is executed. Its return is assigned to the variable result. result therefore has the value 'red'.

Exercise

Declare a variable hello. Assign a function to it returning 'Hello world!'.
var hello = function() {
  ...
};
var hello = function() {
  return 'Hello world!';
};