Print Var in JsFiddle


Print Var in JsFiddle

How would I print something to the result screen in JsFiddle from my JavaScript. I can’t use document.write(), it doesn’t allow it, neither print.
What should I use?


Solution 1:

To be able to see output from console.log() in JSFiddle, go to External Resources on the left-side panel and add the following link for Firebug:

Example of the result after adding firebug-lite-debug.js

Solution 2:

I have a template for this purpose; here is the code I use:


<pre id="output"></pre>


function out()
    var args =, 0);
    document.getElementById('output').innerHTML += args.join(" ") + "\n";

Sample use (JavaScript)

out("Hello world!");
out("Your lottery numbers are:", Math.random(), 999, Math.PI);
out("Today is", new Date());

Solution 3:


document.getElementById('element').innerHTML = ...;


Solution 4:

Might not do what you do, but you can type


And it will print the string into the console of your browser. In chrome push CTRL + SHIFT + J to open the console.

Solution 5:

You can do this --->


Solution 6:

Now jsfiddle can do it from the scratch. Just go to Javascrpt –> Frameworks & extensions –> Jquery(edge) and check Firebug lite checkbox