3

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....

3
  • 2
    WHy don't you run the js commands in Safari?
    – Sathyajith Bhat
    Jan 31, 2012 at 17:50
  • 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, 2012 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, 2012 at 22:44

2 Answers 2

4

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.

5
  • That's pretty sweet, I didn't know about that
    – cutrightjm
    Jan 31, 2012 at 17:54
  • Changed the commands to the OS X ones, the OP is using a Mac.
    – slhck
    Jan 31, 2012 at 21:00
  • My files won't run. Should a file start with something to let Safari know it's a js?
    – Runar
    Jan 31, 2012 at 22:44
  • Typically a browser will not run a .js file unless it is call by <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 <script> tag. To display the result, use either document.write() or console.log().
    – billc.cn
    Feb 1, 2012 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, 2012 at 6:54
-1

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.

1
  • 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, 2012 at 6:57

Not the answer you're looking for? Browse other questions tagged .