Why is the prototype chain not equal?

var arr = [];
arr.toString = = Object.prototype.toString / / false

Mar.05,2021

Array rewrote toString
[] .toString = Array.prototype.toString


arr.toString=Array.prototype.toString
true

because this is an array. You can assume that the array inherits the prototype chain of the object, but rewrites some functions, so it can't be relative. Similarly, can you tostring an object the same as an array tostring


although Array inherits the toString method of Object , it is generally rewritten with its own characteristics

.
var arr = [];
var reg = /sdsd/;
Object.prototype.toString.call(arr); //"[object Array]"
Object.prototype.toString.call("sss");//"[object String]"
Object.prototype.toString.call("reg");//"[object RegExp]"

[].constructor= Array() { [native code] }
{}.constructor= Object() { [native code] }

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b22779-2ad99.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b22779-2ad99.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?