Created
July 5, 2016 03:43
-
-
Save finalight/6bb38e9b377c0804baf4178608e8657e to your computer and use it in GitHub Desktop.
JKJpoJ
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
var celebsArr = [ | |
{id: 1, name: '1'}, | |
{id: 2, name: '2'}, | |
{id: 3, name: '3'} | |
] | |
for (var i =0; i< celebsArr.length; i++){ | |
celebsArr[i]['name'] = function(){ | |
return 'hehe ' + i; | |
} | |
} | |
console.log(celebsArr[0].name()); | |
console.log(celebsArr[1].name()); | |
console.log(celebsArr[2].name()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment