Source: http://www.cril.univ-artois.fr/~paris/cours/javascript/correctionExamen1.pdf