Testing the solution automatically

Running tests by hand is no good: it gets tiresome and boring and that leads, after a while, to not running the tests any longer. Let's do better and write some automatic tests with Jasmine. Following the instructions over at https://jasmine.github.io/pages/getting_started.html, I set up a standalone runner; the required HTML code, using Jasmine Spec Runner 2.6.1, is as follows:

<!DOCTYPE html><html><head>  <meta charset="utf-8">  <title>Jasmine Spec Runner v2.6.1</title>  <link rel="shortcut icon" type="image/png"         href="lib/jasmine-2.6.1/jasmine_favicon.png">  <link rel="stylesheet" href="lib/jasmine-2.6.1/jasmine.css">  <script src="lib/jasmine-2.6.1/jasmine.js"></script>  <script src="lib/jasmine-2.6.1/jasmine-html.js" ...

Get Mastering JavaScript Functional Programming - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.