471639 (6) [Avatar] Offline
When I place the code in Listing 17.9 in a file (REPL.js) in my project, then run it in REPL using .load REPL.js (as directed two paragraphs above the Listing), it doesn't work.

It looks like line 11 is a complete, valid line of JavaScript, so REPL executes it without going into multi-line mode. However, line 12 is not valid code all by itself, so I get INVALID REPL KEYWORD.

This seems really simple, but is there some way to get this to work in REPL? What am I missing here?
471639 (6) [Avatar] Offline
I found what feels like a hack in a SO thread (second answer, https://stackoverflow.com/questions/29203892/how-to-write-multiple-lines-of-code-in-node-repl). I wrapped all of the code in:

if(1){ **Listing 17.9** }

It works, but feels icky.
TheWexler (56) [Avatar] Offline
I apologize for getting to this so late. I wasn't sure at which point this error occurred in the MEAP release cycle. I was just able to load and run repl.js in the final manuscript without errors. If you can copy and paste the code with which you experienced an issue, I can offer a more in depth analysis.