if (!Array.isArray) { Array.isArray = function(){ return Object.prototype.toString.call(this) === "[object Array]"; } } console.log(Array.isArray([1,2,3,4])); console.log(Array.isArray("1,2,3,4"));