Created
September 27, 2015 03:11
-
-
Save itsgreggreg/27d13e2817a360393b17 to your computer and use it in GitHub Desktop.
Advanced JS stuff
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
// Tell me what is going on here: | |
function oneHitter(name, val){ | |
if(!oneHitter.cache) oneHitter.cache = {}; | |
if(!oneHitter.cache[name]) oneHitter.cache[name] = val | |
return oneHitter.cache[name]; | |
} | |
// Tell me what's going on here': | |
var days = ["sun","mon","tues","wed","thurs","fri","sat"]; | |
function lastElement(arr){ | |
return arr.splice(arr.length -1); | |
} | |
var lastDay = lastElement(days); | |
days.concat(lastDay).length === 8; // <- what does this evaluate to and why? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment