3 ms·
I like using toString to convince the console to omit parentheses. Another way would be to use getters, like so: window.__defineGetter__('help', function (
by SerpentJoe 13y ago
I like using toString to convince the console to omit parentheses. Another way would be to use getters, like so:
window.__defineGetter__('help', function () {
console.log('I\'m here for you');
});
- konklone 13y agointeresting, I didn't know about that. You still end up having to do a toString override to properly suppress the 'undefined' return value though: window.__defineGetter__('help', function () { console.log('I\'m here for you'); f = function() {}; f.toString = function() {return " ";}; return f; }); But __defineGetter__ would let the execution of the command work in other places than the JS console, so that's cool.
- deleted 13y ago[deleted]