0

Am using JS Bin and am just starting to study Javascript. In the book am using the output is shown using console.log(function). That does not show anything, and am being forced to use alert(function) to see the output. Are there any other ways i can see the output in JS Bin. Also where exactly does console.log output it, cos command prompt does not show anything.

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
Crazy Duke
  • 57
  • 1
  • 5
  • try with `function write(message) { document.getElementById('message').innerHTML += message + '
    '; }` with html `

    `
    – Vikrant Apr 08 '15 at 10:47
  • 1
    `console.log` is shown in the console of the browsers developer tools. If not there might be a filter set, which logs are shown. – t.niese Apr 08 '15 at 10:47
  • 1
    Press f12 and click the 'console' tab to see console.log("something")'s output – NachoDawg Apr 08 '15 at 10:48

2 Answers2

5

JS bin has a 'Console' Tab, alongside html, css, javascript and output tabs.

Typing console.log in javascript tab displays the output in the console tab.

deadlysyntax
  • 183
  • 10
2

If you're talking jsBin.com or jsFiddle.com or bootply.com or some other playground, then

document.write('foo=' + foo);

works great. But don't do that in the real world, it is a XSS vulnerability vector.

Rap
  • 6,851
  • 3
  • 50
  • 88