Skip to content

Files

Latest commit

 

History

History
18 lines (12 loc) · 1.6 KB

File metadata and controls

18 lines (12 loc) · 1.6 KB

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