1

I am looking for a way to test my JavaScript without using html.

Similar to JS Fiddle or JS Bin, But I want to be able to execute the JavaScript in the output window without having to place it inside HTML

eg

function out()
{
var x = 5;
var y = 10;
z = x * y;
return z;
} 

alert(out());

and have the output window print 50

Thanks for the help

Atraù

4
  • Just press F12 (most browsers) or Ctrl+Shift+K (FireFox/Mozilla) and type into the Console? Commented Jan 6, 2014 at 0:43
  • 1
    See How run a windows console for JavaScript. Commented Jan 6, 2014 at 0:43
  • possible duplicate of Node.js Unit Testing Commented Jan 6, 2014 at 0:46
  • If you just want to execute JavaScript, get NodeJS and an editor with external commands. In Vim for example you can execute the code in the current buffer with :w !node. It's great for quick testing. Commented Jan 6, 2014 at 0:49

2 Answers 2

2

JavaScript code can be executed without actually using an HTML document quite easily. Pressing Ctrl+Shift+J in Internet Explorer or Chrome, and Ctrl+Shift+K in Firefox will lead you to the console, in which you can paste your JavaScript code to be executed. Usually, the best thing to do is to type your commands one at a time, with your function definition first and then the alert() next.

To be safe, do this on about:blank to make sure that there are no conflicting variables.

Sign up to request clarification or add additional context in comments.

Comments

0

If you are using Firefox, you can get an add-on called "Firebug".
It has a lot of features, and whenever you run your scripts, it'll show you errors, etc.

In Chrome, go to View --> Developer --> JavaScript Console.
Lots of features, too. A little bit different UI, depends on what you like.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.