Take the 2-minute tour ×

Possible Duplicate:
Is it possible to run JavaScript in Textmate?

I'm learning javascript at Codecademy

They have a website with a js console and an editor.

But I can't find anything that resembles it to run localy on my Mac.

I just want an editor and a way to run the .js which will prompt, alert, show output and console.log

I have textmate but none of the pages I have found on using e.g. node.js to run the code gives me any good output.

Any suggestion is good right now....

share|improve this question

marked as duplicate by slhck, Tom Wijsman, Sathya Feb 7 '12 at 7:42


WHy don't you run the js commands in Safari? –  Sathya Jan 31 '12 at 17:50
can you accept an answer? –  gadgetmo Jan 31 '12 at 18:44
As you can see, TextMate does that, but you don't have a real console to work with, so I'd stick to the browser. –  slhck Jan 31 '12 at 21:04
My files won't run. Should a file start with something to let Safari know it's a js? –  Runar Jan 31 '12 at 22:44
add comment

3 Answers

up vote 4 down vote accepted

Why don't you use your browser's developer tool's console? All modern browsers have it.

In Chrome and Safari, press Cmd - Option - I and select the console tab. It may not be able to load .js files directly, but you can copy and paste.

share|improve this answer
That's pretty sweet, I didn't know about that –  ekaj Jan 31 '12 at 17:54
Changed the commands to the OS X ones, the OP is using a Mac. –  slhck Jan 31 '12 at 21:00
Typically a browser will not run a .js file unless it is call by &lt;script> tag. What I have been trying to suggest is you copy the contents of the .js file and paste them into the developer tool's console. Alternatively, you could just write a dummy html file that contains just a &lt;script> tag. To display the result, use either document.write() or console.log(). –  billc.cn Feb 1 '12 at 3:46
I wrote a dummy file as you said. The missing pice was '<script src="myscript.js" type="text/javascript" charset="utf-8"></script>' –  Runar Feb 1 '12 at 6:54
add comment

Have you checked out the Mac Store? CodeRunner looks like it should work, but I am not promising as I am a Windows guy. I would look further into it, though. It's about 10 bucks

share|improve this answer
add comment

You can use Firebug. This is a browser extension, with a javascript command line: http://getfirebug.com/commandline.

Adobe Acrobat has an Acrobat Javascript Console: http://acrobatusers.com/tutorials/javascript_console.

BTW, why do you need this? You start using a javascript editor on section 5 of Getting Started with Programming.

share|improve this answer
I need it because I try to do a few assignments on my own. And there is no simple way for saving and making your own projects. –  Runar Feb 1 '12 at 6:57
add comment
