The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

471639 (6) [Avatar] Offline
#1
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
#2
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 (62) [Avatar] Offline
#3
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.