Skip to content

Latest commit

 

History

History

32-instanceofclass

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

InstanceOfClass easy #javascript

by Pawan Kumar @jsartisan

Take the Challenge

Implement a function that verifies whether an object is an instance of a particular class. This function should take both the object and the class as parameters.

class A {}
class B extends A {}

let objB = new B()
instanceOfClass(objB , B) // true
instanceOfClass(objB, A) // true

class C {}
instanceOfClass(objB, C) // false

Back Share your Solutions Check out Solutions