Skip to content

Instantly share code, notes, and snippets.

@amcsi
Created June 30, 2018 01:33
Show Gist options
  • Save amcsi/e5a5e7d0d6d4ac6bd7d1981a1651be07 to your computer and use it in GitHub Desktop.
Save amcsi/e5a5e7d0d6d4ac6bd7d1981a1651be07 to your computer and use it in GitHub Desktop.
asdf
$(function () {
});
function handler () {
var d = 5;
console.info('I was clicked');
backgroundColorer(buttonEl);
}
var buttonEl = $('button');
buttonEl.click(handler);
function backgroundColorer(jQueryElementOrSelectorOrFunction) {
var normalizedAsJqueryElement;
if (typeof jQueryElementOrSelectorOrFunction === 'function') {
jQueryElementOrSelectorOrFunction = jQueryElementOrSelectorOrFunction();
}
if (typeof jQueryElementOrSelector === 'object') {
normalizedAsJqueryElement = jQueryElementOrSelectorOrFunction;
} else {
normalizedAsJqueryElement = $(jQueryElementOrSelector);
}
normalizedAsJqueryElement.css('background-color', 'yellow');
}
// var obj = {
// value: 3,
// logValueIn1Second: function() {
// var that = this;
// console.info('value now', that.value);
// setTimeout(function () {
// console.info('value later', that.value);
// }, 500);
// },
// };
// obj.logValueIn1Second();
var someValue = 4;
function myFunc () {
var someValue = 5;
console.info('someValue', someValue);
}
console.info('someValue', someValue);
myFunc();
console.info('someValue', someValue);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment