JSFiddle - React, Tailwind, and code Playground
by wybiral
HTML
<div id="log">
</div>
CSS
#log > pre {
padding: 5px;
margin: 5px;
border: solid 1px #eee;
}
JavaScript
function log(msg) {
var pre = document.createElement('pre');
if (!_.isString(msg)) {
msg = JSON.stringify(msg);
}
pre.appendChild(document.createTextNode(msg));
document.getElementById('log').appendChild(pre);
}
function Proxy(obj) {
this.obj = obj;
}
Proxy.prototype.toString = function() {
var obj = this.obj;
if (_.isArray(obj)) {
obj = _.map(obj, function(x) {
return obj.toString();
});
}
return obj.toString();
};
Proxy.prototype.call = function() {
return new Proxy([this.obj].concat(_.toArray(arguments)));
};
var pow = new Proxy(Math.pow);
log(pow.call(1, 2))