Javascript Array deepIndexOf(el)
Array.prototype.deepIndexOf = function(el){ for (var i = 0; i < this.length; i++){ if (el === this[i]){ return i;/*from www.j a v a 2 s . c o m*/ }else if (isArray(this[i]) && isArray(el)){ if (this[i].length === el.length){ var equal = true; for (var j = 0; j < el.length; j++){ if (this[i][j] != el[j]){ equal = false; break; } } if (equal){ return i; } } } } return -1; } String.prototype.capitalize = function(){ return this[0].toUpperCase() + this.substr(1); } // Array Remove - By John Resig (MIT Licensed) Array.prototype.remove = function(from, to) { var rest = this.slice((to || from) + 1 || this.length); this.length = from < 0 ? this.length + from : from; return this.push.apply(this, rest); }; function isArray(obj){ return obj.constructor.toString().indexOf("Array") != -1; }