1.typeof

This parameter is used to determine object types

[url=]
[/url]


console.log(

typeof
null

)

//
object

console.log(

typeof

undefined)

//
undefined

console.log(

typeof

[1, 2, 3])

//
object

console.log(

typeof

Boolean)

//
function

console.log(

typeof

1)

//
number

console.log(

typeof

‘1’)

//
string

console.log(

typeof

String)

//
function

console.log(

typeof
boolean

)

//
undefined

console.log(

typeof
true

)

//
boolean

console.lig(

typeof

symbol)

//
symbol

console.log(

typeof

Function)

//
function
[url=]
[/url]





Types are:

1.object

2.function

3.number

4.string

5.boolean

6.undefined

7. Symbol => a unique ID

Note: Each symbol attribute is unique. No two symbols are equal

2.instanceof

instanceof
The operatorThe prototype property of the constructor is used to check if it appears on the prototype chain of an instance object.

The right-hand side must be an object

[url=]
[/url]


console.log(

typeof
null

)

//
object

console.log(

typeof

undefined)

//
undefined

console.log(

typeof

[1, 2, 3])

//
object

console.log(

typeof

Boolean)

//
function

console.log(

typeof

1)

//
number

console.log(

typeof

‘1’)

//
string

console.log(

typeof

String)

//
function

console.log(

typeof
boolean

)

//
undefined

console.log(

typeof
true

)

//
boolean

console.lig(

typeof

symbol)

//
symbol

console.log(

typeof

Function)

//
function
[url=]

[/url]





Note: Each function has a prototype on its prototype chain and an object above it

1. Display prototype: prototype

Whenever you create a new function, a Prototype attribute is created for that function. This property points to the function’s prototype object. All prototype objects automatically get a constructor
The constructorProperty that points to a pointer to the function of the Prototype property.

2. Implicit prototype: __proto__

The implicit prototype points to the prototype of the function that created the object.

object.peototype.__proto__ ==

null




Note: Functions constructed using the function.prototype. bind method have no prototype property.

3. Show the differences and connections between stereotypes and implicit stereotypes

function

P(){}let p1 =

new

P(); p1.__proto__ === P.prototype

//
true

P.prototype

//
{constructor: ƒ}

P.prototype.constructor === P

//
true

P.__proto__ === Function.prototype

//
true




1. The object has only a __proto__ attribute, which points to the prototype attribute of its constructor

function

B(b){

this

.b = b; }

var

b =

new

B(‘seanxiao’)console.log(b)




The attribute of the b Object is __proto__, pointing to the constructor b’s prototype, and B. propType.__proto__ points to object.prototype

Object. Protptype. __protp__ is null

The layer by layer link is the prototype chain.