From the course: Learn JavaScript: Write Modern Code with JavaScript ESNext

Unlock this course with a free trial

Join today to access over 25,000 courses taught by industry experts.

Write a Node script

Write a Node script

- The first step in writing and running JavaScript code using Node is going to be to create a new folder that we're going to put our code into. So to do that, let's open up another window. We're going to need to come back to this code that we wrote for the browser in a minute. So open up another window, and from this new window, we're going to say Open and we're going to create a new folder and we'll just call it generate-table-node. And we're going to hit Open now. And once we've done that, there's a few things we actually have to do to set up our Node project before we can run code. So what we're going to want to do is open up a terminal inside the folder that we just created, make sure it's inside generate-table-node or whatever you called the folder. And the first command we're going to run is npm init dash y. What this will do is initialize our folder as a new NPM package. And the dash Y just means that we're going to accept all the default values for our project. So once we run…

Contents