Skip to content

Instantly share code, notes, and snippets.

@DaveVoyles
Created October 15, 2015 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DaveVoyles/f7cbb5855a9f90eed6fd to your computer and use it in GitHub Desktop.
Save DaveVoyles/f7cbb5855a9f90eed6fd to your computer and use it in GitHub Desktop.
Got tired of writing console.log everywhere
/**
* 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);
};
@csharpfritz
Copy link

Change "function c" to just "function".. you're naming the function twice

@khellang
Copy link

Or just var c = console.log.bind(console); 😄

EDIT: Oops. @mrgenixus was faster than me. Too bad there's no notifications for gists 😛

@DaveVoyles
Copy link
Author

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