Skip to content

Instantly share code, notes, and snippets.

@lennym
Forked from EddieDev/jcc.js
Created November 18, 2011 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lennym/1378035 to your computer and use it in GitHub Desktop.
Save lennym/1378035 to your computer and use it in GitHub Desktop.
Javascript Code Challenge
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