Skip to content

Instantly share code, notes, and snippets.

View EddieDev's full-sized avatar

Eddie EddieDev

  • ECards Media Ltd
View GitHub Profile
@EddieDev
EddieDev / jcci.js
Created November 24, 2011 21:00 — forked from lennym/jcci.js
Javascript Code Challenge Result. http://eblundell.com/javascript-challenge
Array.prototype.joinProperty = function(method, delim) {
var output = [];
for(var i=0; i < this.length; i++){
if(typeof this[i][method] == 'function'){
output.push(this[i][method]());
} else {
output.push(this[i][method]);
}
}
return output.join(delim);
@EddieDev
EddieDev / jcci.js
Created November 18, 2011 22:37
Javascript Code Challenge and Implementation. http://eblundell.com/javascript-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);
}
}
@EddieDev
EddieDev / jcc.js
Created November 18, 2011 22:36
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);
}
}