Isn't the string an instance of String?

clipboard.png

as you can see from the figure, the _ _ proto__ attribute of a points to the prototype, of String, which means that an is an instance of String.
but why is instanceof false?

May.22,2021

it turns out that instanceof cannot be used to determine the basic library type.


it is best to use literals for basic data types

var a = '122'
console.log(typeof a) // string
console.log(b instanceof String) // false

var b = new String('122');
console.log(typeof a) // object
console.log(b instanceof String) // true

//  
console.log(Object.prototype.toString.call(a)) // [object String]
console.log(Object.prototype.toString.call(b)) // [object String]

Packaging types

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-1b4006c-2c4c1.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-1b4006c-2c4c1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?