Another very good resource is A re-introduction to JavaScript (JS tutorial)
You have many options for running JavaScript code:
- Use a website such as repl.it
- Use a website such as codepen
- Write a simple HTML page that uses a
<script>
tag containing JavaScript - Write a simple HTML page that uses a
<script>
tag to load your JavaScript file - Install NodeJS using
brew
:- brew install node
- brew --version # check the version: should print a 6.x or 7.x version
- touch hello.js
- put something in hello.js, such as the line: console.log('Hello from JavaScript.');
- run hello.js using node: node hello.js