Created
May 22, 2014 03:23
-
-
Save chochinlu/3101ecbb9ff46f7a445e to your computer and use it in GitHub Desktop.
js definitive guide 6th -- ch8.3
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 getIndexNames(o, a){ | |
var a = a || []; //if (a === undefined) a = []; | |
for(var index in o){ | |
console.log("---"+ o[index]); | |
a.push(index); | |
}; | |
return a; | |
} | |
var a = getIndexNames(["111"]); | |
console.log(a); //['0'] | |
getIndexNames(["aaa", "bbb", "ccc"], a); | |
console.log(a);//['0', '0', '1', '2'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment