November 2017
Intermediate to advanced
386 pages
9h 22m
English
Here are solutions (partial, or worked out in full) to the questions posed along the text. In many cases, there are extra questions for you to do further work.
1.1. Classes as first class objects. If you remember that a class is basically a function that can be used with new, then it stands to reason that we should be able to pass classes as parameters to other functions. The makeSaluteClass() basically creates a class (that is, a special function) that uses a closure to remember the value of term. We'll be seeing more examples of these kind of things in the rest of the book.
1.2. Factorial errors. The key to avoiding repeated tests is to write a function that will: