Node vs Visual Editor

Very inexperienced here and just started going through these exercises last week! I’m on exercise 19 and confused as to when we switch to “node” in the terminal vs working with the code in the visual editor. What’s the reason for the switch in these exercises and why can’t I run the same code by entering it into the visual editor and running it in terminal? Thank you!

With Visual Studio Code or Atom you probably can get away with running it always in the editor, but eventually you’ll hit a brick wall and need to use terminal (what you call Node). Basically I work like this:

  1. One window has Visual Studio Code (or Vim for me).
  2. Another has Cmdr.exe or PowerShell or Terminal (on OSX).
  3. I do some working on my code in #1 (my editor, Vim or Visual Studio Code).
  4. After a few lines I switch to #2 the Terminal (alt-tab on Windows, cmd-tab on OSX) then run the code with node. Usually just hitting the up arrow will rerun the last command.
  5. Then there’s errors usually so I switch back to #1 and do some more writing and fixing.

I do this “code-run-fix-code-run-fix” loop over and over until I’m done.

A free service run by Zed A. Shaw for learncodethehardway.org.