Jump to content

JavaScript/Reserved words/instanceof

From Wikibooks, open books for an open world
Previous: inReserved wordsNext: int

The instanceof keyword

[edit | edit source]

The instanceof keyword returns true, if the left-hand side of the operator corresponds to the class on the right-hand side.

Syntax

[edit | edit source]
objectinstanceofclass

Examples

[edit | edit source]
theArray=newArray();if(theArrayinstanceofArray){for(vari=0;i<theArray.length;i++){[]}}
Previous: inReserved wordsNext: int
close