Created
June 30, 2018 01:33
-
-
Save amcsi/e5a5e7d0d6d4ac6bd7d1981a1651be07 to your computer and use it in GitHub Desktop.
asdf
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
$(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