Last active
August 29, 2015 14:17
-
-
Save JohnLouderback/eef18f3630d2911c5347 to your computer and use it in GitHub Desktop.
Make the JS console "clear" function act the terminal "clear" command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
if (typeof clear !== 'undefined') { | |
var oldClear = clear; | |
Object.defineProperty(window, 'clear', { | |
get: function() { | |
oldClear(); | |
return oldClear; | |
} | |
}); | |
} | |
})(); | |
// Now we can type "clear" instead of "clear()" in developer consoles. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now you can use either "clear()" or "clear" in the console to clear the console.