How and where to run JavaScript
Great, you know how to type a little bit of JavaScript. Awesome! Now how can you run it? How can you run it on your own?
Let’s start with 3 fairly easy options.
Option 1: html file on your desktop
Open up any text program on your computer. On a pc you can use notepad. On a mac you can use textedit.
create a new file on your desktop and save it as test.html
.
Add this content and save:
Now open this file in your browser with the File->Open File
menu option.
Open the console to see the console.log()
message in the browser console pane.
In Chrome you can open the console with View->Developer->JavaScript Console
.
Option 2: Browser web developer tools console
Open the console, and type in any JavaScript command. Try console.log('hello world!!!')
. Hit the enter
key to run it and see the result.
In Chrome you can open the console with View->Developer->JavaScript Console
.
Option 3: Exercises on this site
On this site I’ve set up exercises that that are very similar to the browser and browser console. You can run JavaScript there and see the result.