He works with his native
["a", "b", "c", "d"].slice(1,3).join("-")
If you want it to behave as your definition, you can use it this way:
Array.prototype.myJoin = function(seperator,start,end){ if(!start) start = 0; if(!end) end = this.length - 1; end++; return this.slice(start,end).join(seperator); }; var arr = ["a", "b", "c", "d"]; arr.myJoin("-",2,3)
source share