https://github.com/benbowes/jsfiddle-value-printer
Prints values in the result panel....
https://github.com/benbowes/jsfiddle-value-printer
Last synced: 6 months ago
JSON representation
Prints values in the result panel....
- Host: GitHub
- URL: https://github.com/benbowes/jsfiddle-value-printer
- Owner: benbowes
- Created: 2016-09-05T01:23:25.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-05T03:50:22.000Z (almost 10 years ago)
- Last Synced: 2025-08-16T01:33:47.491Z (12 months ago)
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jsfiddle-value-printer
For printing values in the result panel... for when you're too lazy to open the inspector to view console.log() output.
### In the HTML window...
```javascript
Results
var index = 0;
var printResult = function(msg) {
index++;
var result = '<p class="results__result">';
result += '<span class="results__result-index">' + index + ': </span>';
result += JSON.stringify(msg, null, 2) + ';'
result += '</p>';
document.querySelector('.results').innerHTML += result;
}
```
### In the CSS window...
```css
body {
font-family: sans-serif;
padding: 1em;
}
.results {
padding: 0.5em 1em;
background: #fff;
display: block;
}
.results__result:not(:last-child) {
border-bottom: 1px solid #f1f1f1;
}
.results__result {
padding: 1em;
}
.results__result-index {
color: #ccc;
}
```