Re:Proxy, a new JavaScript ES6 feature
by syspec on Friday May 18, 2018 @03:15AM
(#17099306)
The use of `document.write` for this entry instead of the usual console threw me off at first.
[ Parent
| on HN ]
Re:Proxy, a new JavaScript ES6 feature
by tlrobinson on Friday May 18, 2018 @03:32AM
(#17099369)
Presumably so you can see the output in the embedded JSFiddles.
FYI, if you're embedding a JSFiddle you could also just drop this in the HTML section then use console.log:
<script>console.log = function(str) { document.write(str, "<br/>") }</script>JSFiddle should just have a tick box with "intercept console.log" and a tab with the output .
Re:Proxy, a new JavaScript ES6 feature
by tirthbodawala on Friday May 18, 2018 @04:22AM
(#17099588)
Hahahaha...It should!
I feel as though this is a missed opportunity to use a proxy!
I initially stared at that with horror, but I suspect that Stack Overflow does something similar with their code snippets. If you write console.log it gets output to the screen [0]
Re:Proxy, a new JavaScript ES6 feature
by yashthakur on Friday May 18, 2018 @07:28AM
(#17100531)
It is just because since all the JSFiddles are on one page. All the console.log would be together in the console and it would be difficult to know which console is for which code.
Hence document.write is used.
Though HTML could be used but that would just increase one more tab to show useless HTML. ;)