How to code in javascript???

Stux

  • Posts: 70
I understand how to code thanks to code academy but there is one thing I can't find out. When I am just on my computer how do I code. As far as I know there is not a stand alone program like the coding part of code academy where I can just code and then run my program. When I use notepad it gives me an error message. This message looks something like this:

Script: C:\Users\Stewart\Downloads\script (1).js
Line: 1
Char: 2
Error: Object expected
Code: 800A138F
Source: Microsoft JScript runtime error

This is the code:

var name = prompt("hi,what is your name?")

I have tried the chrome javascript console and it works however I cannot do multi lined code in it because when I move on to a new line it runs the one before.
Please help!!!
Stew

Joe

  • *
  • Posts: 2478
You'll want to create an HTML page that calls the JavaScript and not try to execute it directly.

Here's an example: http://www.w3schools.com/js/tryit.asp?filename=tryjs_events