Q
How does the instanceof operator work in JavaScript?

Answer & Solution

Answer: Option A
Solution:
The instanceof operator checks if an object has a specific prototype in its prototype chain.
Related Questions on Average

What will be the output of typeof {} in JavaScript?

A). object

B). array

C). null

D). undefined

What is the output of typeof Symbol('id') in JavaScript?

A). symbol

B). object

C). string

D). null

What will be the output of [] instanceof Array in JavaScript?

A). 1

B). 0

C). null

D). undefined

How does the typeof operator handle arrays in JavaScript?

A). array

B). object

C). undefined

D). null

How does the instanceof operator behave with primitive values in JavaScript?

A). Throws an error

B). Returns true for all primitive values

C). Returns false for all primitive values

D). Primitive values cannot be used with instanceof

What is the result of typeof undefined in JavaScript?

A). undefined

B). string

C). null

D). object

What is the output of typeof function(){} in JavaScript?

A). function

B). object

C). undefined

D). null

What does typeof true evaluate to in JavaScript?

A). boolean

B). number

C). string

D). undefined

What is the result of Boolean('false') in JavaScript?

A). 1

B). 0

C). NaN

D). null

What will be the output of typeof null in JavaScript?

A). object

B). null

C). undefined

D). string