Created
October 15, 2015 00:58
-
-
Save DaveVoyles/f7cbb5855a9f90eed6fd to your computer and use it in GitHub Desktop.
Got tired of writing console.log everywhere
This file contains hidden or 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
/** | |
* Got tired of writing console.log everywhere, so this is my shorthand function for it. | |
* @param {string} - sVal | |
* @returns {function} - console.log('sVal') | |
*/ | |
var c = function c (sVal) { | |
return console.log(sVal); | |
}; |
Or just var c = console.log.bind(console);
๐
EDIT: Oops. @mrgenixus was faster than me. Too bad there's no notifications for gists ๐
I name it twice because if I don't it is only an anonymous function. If I declare it as a variable, then it prevents hoisting.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change "function c" to just "function".. you're naming the function twice