Created
November 15, 2012 20:06
-
-
Save cowboy/4080907 to your computer and use it in GitHub Desktop.
JavaScript: log= (insanity?)
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
/* | |
* log= (insanity?) | |
* http://benalman.com/ | |
* | |
* Copyright (c) 2012 "Cowboy" Ben Alman | |
* Licensed under the MIT license. | |
*/ | |
Object.defineProperty(global, 'log', { | |
set: function(args) { | |
console.log.apply(console, Array.isArray(args) ? args : [args]); | |
} | |
}); |
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
// this is less to type | |
log='abc'; | |
log=['a', 'b', 'c', 1, 2, 3, true, false]; | |
// than this is | |
console.log('abc'); | |
console.log('a', 'b', 'c', 1, 2, 3, true, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
log('a', 'b', 'c', 1, 2, 3, true, false); is even less to type by one = char. And more reasonable.