We can use the Object. The prototype. ToString. Call whether data for pure JSON or array Such as:
var arr=[aa,bb,cc];
arr.toString() / / output "aa, bb, cc"
Copy the code
but
Object.prototype.toString.call(arr)// Output "[object Array]"
Copy the code
The toString () and the Object. The prototype. ToString. Call () is not the same. All data types are inherited in the js Object, Array also inherited the Object, but the Array will override inherited from the Object’s toString method, so the Object. The prototype. The toString toString and Array is different of the two methods.