Created
November 18, 2011 22:36
-
-
Save EddieDev/1377991 to your computer and use it in GitHub Desktop.
Javascript Code Challenge
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
Array.prototype.joinProperty = function(delim,method) { | |
var output = ''; | |
for(var i=0; i < this.length; i++){ | |
if(this[i].hasOwnProperty(method)){ | |
output = output.concat(this[i][method],delim); | |
}else if(eval("typeof this[i]."+method+" != 'undefined'")){ | |
output = output.concat(eval('this[i].'+method+'()'),delim); | |
} | |
} | |
return output.slice(0,output.length-delim.length); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment