var is_array = function(value){
return Object.prototype.toString.apply(value) === '[object Array]';
}
console.time('arry');
console.log(is_array([1,2]));//运行速度:0.499ms
console.timeEnd('arry');
var test=null;
test = function(){};
test.prototype.is_array = function(value){
return Object.prototype.toString.apply(value) === '[object Array]';
}
var test2 = new test();
console.time('arry2');
console.log(test2.is_array([1,2])); //运行速度: 0.252ms
console.timeEnd('arry2');