Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This won't help you step through code or break on errors, but it's a useful way to get the same debug console for your project on all browsers. </p> <pre><code>myLog = function() { if (!myLog._div) { myLog.createDiv(); } var logEntry = document.createElement('span'); for (var i=0; i &lt; arguments.length; i++) { logEntry.innerHTML += myLog.toJson(arguments[i]) + '&lt;br /&gt;'; } logEntry.innerHTML += '&lt;br /&gt;'; myLog._div.appendChild(logEntry); } myLog.createDiv = function() { myLog._div = document.body.appendChild(document.createElement('div')); var props = { position:'absolute', top:'10px', right:'10px', background:'#333', border:'5px solid #333', color: 'white', width: '400px', height: '300px', overflow: 'auto', fontFamily: 'courier new', fontSize: '11px', whiteSpace: 'nowrap' } for (var key in props) { myLog._div.style[key] = props[key]; } } myLog.toJSON = function(obj) { if (typeof window.uneval == 'function') { return uneval(obj); } if (typeof obj == 'object') { if (!obj) { return 'null'; } var list = []; if (obj instanceof Array) { for (var i=0;i &lt; obj.length;i++) { list.push(this.toJson(obj[i])); } return '[' + list.join(',') + ']'; } else { for (var prop in obj) { list.push('"' + prop + '":' + this.toJson(obj[prop])); } return '{' + list.join(',') + '}'; } } else if (typeof obj == 'string') { return '"' + obj.replace(/(["'])/g, '\\$1') + '"'; } else { return new String(obj); } } myLog('log statement'); myLog('logging an object', { name: 'Marcus', likes: 'js' }); </code></pre> <p>This is put together pretty hastily and is a bit sloppy, but it's useful nonetheless and can be improved easily!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload