This file contains 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
for (var attrname in obj2) { obj1[attrname] = obj2[attrname]; } | |
// smashless version | |
/** | |
* Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1 | |
* @param obj1 | |
* @param obj2 | |
* @returns obj3 a new object based on obj1 and obj2 | |
*/ | |
function merge_options(obj1,obj2){ |
This file contains 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 (ev) { | |
e = ev || window.event; | |
var target = e.target || e.srcElement; | |
// have fun here | |
// cancel bubbling? | |
e.cancelBubble = true; | |
if(e.stopPropagation) { | |
e.stopPropagation(); |
This file contains 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 fib(n,undefined){ | |
if(fib.cache[n] === undefined) | |
fib.cache[n] = fib(n-1) + fib(n-2); | |
return fib.cache[n]; | |
} | |
fib.cache = [0,1,1]; | |
fib(10); | |
console.log(fib.cache); |
NewerOlder