By Developers, For Developers

Historical errata for CoffeeScript

PDF PgPaper PgTypeDescriptionFixed onComments
17ERROR

The definition of the choices option for the function promptForAction looks rather odd: {name: ‘deposit’, ‘Deposit $ into this account’}

It may be intentional and coffeescript doesn’t choke on it. However, since the odd syntax isn’t mentioned in the text and the value of the string never appears in the program output, I’m assuming it’s missing a key or shouldn’t be there at all.

2014-12-05
15SUGGEST

I’m still working my way through the book, which is excellent!

This is just a syntax suggestion. For the bound functions example, you use JS-style semicolons to end two of the lines. You also wrapped a console.log call in parens, where in other examples you don’t. Based on the previous examples, I would have expected something like:

majorTom = { secondsLeft: 4 }

majorTom.countDown = ->
setTimeout (=>
console.log secondsLeft secondsLeft—
if secondsLeft > 0 countDown()
), 1000

majorTom.countDown()

2014-12-05
60TYPO

The code excerpt for ‘jQuery/src/card.coffee’ has been supplanted by ‘jQuery/src/board.coffee.’

2014-12-05
50TYPO

I think ‘grunt-coffee’ in the command ‘npm install —save-dev grunt-coffee’ should be ‘grunt-contrib-coffee’; ‘grunt-contrib-coffee’ is used in the Gruntfile soon thereafter.

2014-12-05
46TYPO

It took me a while to figure out what was going on here, but essentially, the newAccountPrompt validate function does not have access to @allAccounts unless the fat arrow is used to keep the intending binding of this.

As currently written, the error reported is on the line trying to loop through allAccounts: “TypeError: Cannot read property ‘length’ of undefined”

2014-12-05
50ERROR

The grunt installation instructions did not work for me until I also installed grunt-cli:

npm install -g grunt-cli

By ‘did not work’, I mean I got a “command not found” when typing ‘grunt’ as shown on PDF Page 51

2014-12-05
52SUGGEST

There is reference for installing Bower in the ‘Managing Front-End Dependencies with Bower’ section. The text goes from a description of the tool immediately to “bower init”.

An installation line prior to ‘bower init’ might be nice:
‘npm install -g bower’

2014-12-05
65SUGGEST

Regarding the wrap up text that states “Just add a dash of stylesheets”, it might be nice to provide direct links to said stylesheets so users can easily copy/paste to create local instances.

2014-12-05
111TYPO

“The code above skips a loop iteration every time !(distance > 1d12).”
should read
“The code above skips a loop iteration every time !(distance < 1e12).”

2015-01-01
9TYPO

At the very bottom of the printed page 9, the last 9 lines seem to have the formatting get away from you. There really shouldn’t be any HTML visible here.

70TYPO

In two places on page 70 filenames (# strings.js and # main.js) failed to format as a gray bar background.

00TYPO

if strikes >= 3 then out()

CoffeeScript also allows postfix
conditionals
, such as


out() if strikes >= 3

I assume that the HTML in there isn’t supposed to be rendered as literal HTML (my suspicion is the closing tag being instead of is causing this). It would be good if you could correct your PDF ebook copies (or perhaps other e-books; I don’t know how pervasive this error is).

If it is of any consequence, I was reading this using Evince on a GNU/Linux machine.

Categories: