Skip to content

Instantly share code, notes, and snippets.

@arapehl
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arapehl/11221680 to your computer and use it in GitHub Desktop.
Save arapehl/11221680 to your computer and use it in GitHub Desktop.
Functions should return a value
var contentEl = $('foo').hasClass('content') ? target : $(target).closest('.content');
var contentEl;
function getContentEl(target) {
contentEl = $(target).hasClass('content') ? target : $(target).closest('.content');
}
getContentEl('foo');
var contentEl;
function getContentEl(target) {
return $(target).hasClass('content') ? target : $(target).closest('.content');
}
contentEl = getContentEl('foo');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment