Running JavaScript

I completed the JavaScript Syntax, Part 1 and it says I should know how to

  • Run JavaScript on your computer
  • Run JavaScript in the browser

What does that mean? All I have been doing is clicking ‘Save’/‘Run’ to run the program in the editor of the Codecademy website. What does it mean to run JS on the computer and run JS in the browser?

No, when you click save and run in CC it saves it on the CC servers and executes the code on the CC servers and displays the result on your browser.

Usually JS is executed in the browser, however it is possible to run JS on your computer using node.
Here’s the link to installing node.
When executing JS on your own computer with node installed, you simply call node in the terminal along with the name of the file you wish to execute:

node myJSExample.js

Assuming you have node properly installed, it will execute your script.
The key difference is that when JS is used in the browser, it usually is tied to an HTML page which it either animates, stores data from or otherwise.

Hope this helps :slight_smile:

1 Like