small medium large xlarge

Errata for CoffeeScript

 

The latest version of the book is P1.0, released over 4 years ago. If you've bought a PDF of the book and would like to upgrade it to this version (for free), visit your home page.

By default this page displays the errata for the latest version of the book. If you have a previous version, select it here:

If you've found a new error, please submit it.

  • Typo
  • Tech. error
  • Suggestion
  • Maybe next edition
  • Not a problem
  • Reported in: P1.0 (08-Aug-11)
  • Fixed: 13-Aug-11, awaiting book release
#47355
Paper page: xvii

parens aren't needed in the CoffeeScript line that assigns to cubedList--R. Mark Volkmann

Trevor Burnham says: No, it does. I think your confusion is from running @cubedList = cube num for num in list@ on the REPL; since 1.1, if you put a loop expression on the REPL, you get the value of that loop (that is, a list comprehension). But if you check the value of @cubedList@ after running that line, you'll find that it's just a single number, because @cubedList = cube num for num in list@ parses as @(cubedList = cube num) for num in list@.
  • Reported in: P1.0 (24-Mar-12)
#48978
PDF page: 2
Current Node.js installer (v0.6.14) from Node.js home page installs both Node.js and npm natively on Windows and added to %PATH%, no Cygwin required t...more...
  • Reported in: P1.0 (30-Jul-11)
  • Fixed: 06-Aug-11, awaiting book release
#47323
PDF page: 2
Standard cygwin doesn't include curl, which you need for the installation of nodejs PS i hate cygwin. You're either on windows or not. There should ...more...
Trevor Burnham says: Yes, Cygwin is a pain. I feel for you. However, as the book notes, Node 0.6 is supposed to provide full native support for Windows—and it should be out in just a few months.
  • Reported in: P1.0 (18-Dec-11)
#48356
PDF page: 7
"$ coffee -cwo js coffee" This is useful and I wonder if its worth adding more about how to work effectively with coffee alongside node.js, and mor...more...
  • Reported in: P1.0 (25-Aug-12)
#49739
PDF page: 18
2,2 Scope: Where you see 'em, first example Book says: age = 99 reincarnate = -> age = 0 reincarnate() console.log "I am #{age} years old" ...more...
  • Reported in: P1.0 (25-Aug-12)
#49740
PDF page: 18

for previous report, forgot this:

$ coffee -v
CoffeeScript version 1.3.3--Greg Clarke

  • Reported in: P1.0 (28-Jan-12)
#48606
PDF page: 18
With Node.js version v0.6.0 and CoffeScript version 1.2.0 , when this snippet is executed : count = 0 incrementCount = -> count++ incrementCount...more...
  • Reported in: P1.0 (05-Feb-12)
#48662
PDF page: 20

In the last line of the purple box, sew should be sow. You sew clothes and sow seeds.--Chris Proctor

  • Reported in: P1.0 (02-Sep-11)
  • Fixed: 16-Sep-11, awaiting book release
#47497
PDF page: 20

In the box "Shadowing: The Name's the Same",
"lest you sew the seeds..." should be
"lest you sow the seed..."--Marc Paterno

Trevor Burnham says: Duplicate of #47372.
  • Reported in: P1.0 (10-May-12)
#49302
PDF page: 20

"lest you sew the seeds of scope confusion." should be "lest you sow the seeds of scope confusion."--Kirk Klobe

  • Reported in: P1.0 (14-May-12)
#49328
PDF page: 23
Book says: setName 'Lulu' console.log name # 'Lulu' console.log @name # undefined But when I run the code, I don't get "undefined" for the la...more...
  • Reported in: P1.0 (03-Sep-11)
#47500
PDF page: 27

On the last line of the page, "ellipse" should probably be "ellipsis".--Marc Paterno

  • Reported in: P1.0 (08-Dec-11)
#48232
PDF page: 29

"sew the seeds" s/b "sow the seeds"--Pete

  • Reported in: P1.0 (23-Nov-12)
#50199
PDF page: 42
Where slices are described, the following example is given: coffee> ['this', 'that', 'the other'][1..] ['that', 'the other'] The answer should th...more...
  • Reported in: P1.0 (20-Feb-13)
#50839
PDF page: 42
Paper page: 20
"Shadowing: The Name's the Same" section, right at the end "...lest you sew the seeds of scope confusion". When we're talking about seeds, the verb is...more...
  • Reported in: P1.0 (11-Aug-11)
#47363
PDF page: 46
germanToEnglish: {ja: 'yes', nein: 'no'} should be germanToEnglish = {ja: 'yes', nein: 'no'} Also germanToEnglish[ja]? should be germanToEng...more...
Trevor Burnham says: Thanks for catching that!
  • Reported in: P1.0 (09-Nov-11)
#47923
Paper page: 46
The second paragraph ends with, "Think of it this way: values live *in* an array, while you have keys *of* an array." Don't you mean, "...have keys *o...more...
  • Reported in: P1.0 (17-Nov-11)
#47957
PDF page: 48

> the next section, we’ll meet one of my favorite antirepetition features.

antirepetition -> anti repetition--pichon

  • Reported in: P1.0 (15-Dec-11)
#48301
PDF page: 48

I'd just explain it here, the topic is fresh in the readers mind so its the perfect time to explain.--Colin Jack

  • Reported in: P1.0 (07-Nov-12)
#50146
PDF page: 51
randomLetter() uses the following to generate a random number: randomNumber = Math.ceil(Math.random() * totalTiles) However, Math.random() ret...more...
  • Reported in: P1.0 (15-Dec-11)
#48299
PDF page: 52
On the 5x5 example, two suggestions. The first is that I think it'd be good if you provided tests, that way as we write the code we can run them t...more...
  • Reported in: P1.0 (07-Nov-12)
#50149
PDF page: 52
I see no reason to transpose the grid for printing. printGrid() should be: printGrid = -> rowStrings = (' ' + row.join(' | ') for row in gr...more...
  • Reported in: P1.0 (16-Sep-11)
#47582
PDF page: 54
the call scoreMove in promptForTile2 refers to the coordinate in a different order than previously defined in the code x1, y1, x2, y2 may be explai...more...
  • Reported in: P1.0 (23-Nov-11)
#48019
PDF page: 64
tribble1 = new Tribble tribble2 = new Tribble tribble1.die() ...more...
  • Reported in: P1.0 (15-Dec-11)
#48296
PDF page: 64
I get what you are saying but I think it could do with rewording: "Each time a new tribble is created, Tribble.count is increased by one. (We can ...more...
  • Reported in: P1.0 (15-Dec-11)
#48297
PDF page: 64

I think a diagram would help with the paragraph starting:

"Notice that Tribble.count is referred to as"

--Colin Jack

  • Reported in: P1.0 (21-Dec-11)
#48378
PDF page: 68
End of section 3.3: germanToEnglish: {ja: 'yes', nein: 'no'} should be germanToEnglish = {ja: 'yes', nein: 'no'} in order for the next line to work w...more...
  • Reported in: P1.0 (16-Sep-11)
#47581
PDF page: 69

global instead of exports in the explanation of the first statement of OWL2.js--Eugene Van den Bulke

  • Reported in: P1.0 (14-Nov-11)
#47946
PDF page: 72
At the very top of the page it shows the code to require the external files in console.coffee: {Dictionary} = require './Dictionary' {Grid} = re...more...
  • Reported in: P1.0 (16-Dec-11)
#48319
PDF page: 73
"We haven’t discussed bound functions on classes, so perhaps a demonstration is in order." Was thinking it might actually be worth a small section...more...
  • Reported in: P1.0 (16-Dec-11)
#48328
PDF page: 77
"$('h1').click -> $(this).html $(this).html() + '!'" As you say earlier this sort of code can be baffling so it seems pretty odd using it as a code...more...
  • Reported in: P1.0 (16-Dec-11)
#48329
PDF page: 79
"Web Interactivity with jQuery" This chapter is excellent, when starting out with jQuery I wish I'd had this to read. Also pointing out inconsisten...more...
  • Reported in: P1.0 (29-Jun-12)
#49470
PDF page: 80
The drawTiles function iterates through y before x in the repo Instead of: for x in [0...blah] for y in [0...blah] ...the jq5x5.coffee does ...more...
  • Reported in: P1.0 (18-Dec-11)
#48354
PDF page: 80
"We’re going to create a browser-based version of the game from the last chapter using the same three class files" I think it'd be worth explaining...more...
  • Reported in: P1.0 (18-Dec-11)
#48353
PDF page: 81
"However, for our purposes, in-browser compilation will do fine" My experience is it didn't, I tried typing in the example and unsurprisingly made ...more...
  • Reported in: P1.0 (18-Dec-11)
#48355
PDF page: 85

I think this line could have done with some explanation:

"[x, y] = @id.match(/(\d+)_(\d+)/)[1..]"--Colin Jack

  • Reported in: P1.0 (18-Dec-11)
#48350
PDF page: 86
I know its only an example app but you could make the code say this by having a variable "isFirstMove": "If selectedCoordinates is null, then this ...more...
  • Reported in: P1.0 (18-Dec-11)
#48351
PDF page: 86
I'm maybe way off but is it not worth breaking this up a bit? $notice = $(""" <p class="notice"> #{currPlayer} formed the following #{newWords.le...more...
  • Reported in: P1.0 (18-Dec-11)
#48352
PDF page: 86
Looking at lines like this I'm wondering if its worth somewhere describing when you would recommend using and not using parentheses to improve readabi...more...
  • Reported in: P1.0 (18-Dec-11)
#48360
PDF page: 86
"selectedCoordinates.x2 = x selectedCoordinates.y2 = y" Might be worth just explaining why you're using this approach not = {x2...}. I realise the...more...
  • Reported in: P1.0 (18-Dec-11)
#48361
PDF page: 86

I'm thinking this should be in a paragraph with class notice:

$notice = $("#{currPlayer.name} formed no words this turn.")--Colin Jack

  • Reported in: P1.0 (19-Oct-11)
#47785
PDF page: 93
For the 5x5 demo game, the Player.coffee listing does not indicate that the "scoreMove" function is to be included in this file (as within the supplie...more...
  • Reported in: P1.0 (23-Nov-11)
#48021
PDF page: 97

When I download 5x5server.coffee, it is expecting a Game.coffee but it is not described what is that? Or am I missing something?--Swaroop

  • Reported in: P1.0 (27-Aug-14)
#77258
PDF page: 98

5x5server.coffee won't run as is: no method 'compiler' error.

Connect framework and as of Jul 2011 no longer includes compiler--User

  • Reported in: P1.0 (17-Nov-11)
#47958
PDF page: 100
game = new Game This won't work since a) the game file is not required (it is in the sample code but that's not mentioned in the text) and b) there...more...
  • Reported in: P1.0 (17-Nov-11)
#47959
PDF page: 100
If we run the app as suggested in the beginning of the page, it will lead to an error, because socket.io is not installed. The issue here is that the ...more...
  • Reported in: P1.0 (05-Mar-12)
#48888
PDF page: 103
Section 2.2, scope example not working as expected -- text says I should expect a function to modify the value of a variable first declared before, th...more...
  • Reported in: P1.0 (05-Mar-12)
#48889
PDF page: 103
Re item 103 that I just submitted: if I run the example from REPL (coffee> prompt), it behaves one way; if I edit a file with the same script and exec...more...
  • Reported in: P1.0 (16-Dec-11)
#48318
PDF page: 112
"As a rule, you should never use the same name for a prototype property and an instance property." The exmaple was a good one and its excellent to ...more...
  • Reported in: P1.0 (05-Aug-11)
#47346
Paper page: 116

The page reference at the top of the page should be 96 instead of 89.--R. Mark Volkmann

  • Reported in: P1.0 (01-Jan-13)
#50424
PDF page: 121

typeof x != 'undefined' && x !== null

should be

typeof x !== 'undefined' && x !== null--Andreas Kemkes

  • Reported in: P1.0 (01-Jan-13)
#50425
PDF page: 121
Trying x ?= y on coffeescript.org results in: "the variable "x" can't be assigned with ?= because it has not been defined." (coffeescript.org/#try...more...

Stuff To Be Considered in the Next Edition

  • Reported in: P1.0 (12-Aug-11)
#47372
Paper page: 20
The "Shadowing" bar ends with: "...lest you sew the seeds of scope confusion." This is the wrong homonym. Should be "sow" in this case, as the metapho...more...
Trevor Burnham says: Good catch! Apparently I need a crash course on metaphors.
  • Reported in: P1.0 (05-Aug-11)
#47345
Paper page: 26

I think "can have an argument with several default values" should be "can have several arguments with default values".--R. Mark Volkmann

Trevor Burnham says: Whoops! Thanks for catching that.
  • Reported in: P1.0 (29-Jul-11)
#47322
PDF page: 27

In purple box: This (or it's equivalent, a||=b) ... Wrong its.--Chris Proctor

Trevor Burnham says: Thanks for reporting this! I don't usually make that mistake, but its something that happens to all of us.
  • Reported in: B3.0 (30-Jun-11)
#47238
PDF page: 33

The second question in the first exercise of chapter two seems totally out of place.--Nicolas Buduroi

Trevor Burnham says: Sorry, the book is already going to the printer, so these sorts of flaws will have to wait until the next edition to get ironed out.
  • Reported in: B3.0 (05-Jul-11)
#47247
PDF page: 86
The example in Chapter 2, creating a stdin prompt for the 5x5 game, the strToCoordinates function in the book only uses the isInteger check, but it al...more...
  • Reported in: B3.0 (18-Jul-11)
#47277
PDF page: 122

x in arr y.indexOf(x) >= 0*

where y should probably be arr, no?--Chris Ryland

Trevor Burnham says: D'oh. Thanks for spotting this.