Skip to content

Instantly share code, notes, and snippets.

@vestige
Created October 9, 2012 13:57
Show Gist options
  • Select an option

  • Save vestige/3858982 to your computer and use it in GitHub Desktop.

Select an option

Save vestige/3858982 to your computer and use it in GitHub Desktop.
99.js
var myarray;
(function() {
var astr = "[object Array]",
toString = Object.prototype.toString;
function isArray(a){
return toString.call(a) === astr;
}
function indexOf(haystack, needle) {
var i = 0,
max = haystack.length;
for (; i < max; i += 1) {
if (haystack[i] === needle) {
return i;
}
}
return -1;
}
myarray = {
isArray: isArray,
indexOf: indexOf,
inArray: indexOf
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment