Hello in this JavaScript video I am going to demonstrate the instance of operator. So this is fantastic if you want to check if you know this instance is object is of a particular class. And you can do that using the instance of operator. So all I'll do is I'll get rid of this for this video. So here, I'm going to create a variable on say is invalid. So this will store true or false, if the actual core object is you know of color class.
And to check this You nearly immediately specify the name of your objects of color OBJ for example, instance of then the name of your class which is call and we can print this to false is better return because it is of that class and we reload. We Get true. Okay guys, testicle. Let me just quickly create a new Java class. I'm not gonna put anything in there, because all I want to do is just create an object of this class and check if it is a call and we will get a false result. And we don't actually even put a constructor.
We don't put a constructor, he creates one by default, so we don't need to worry about that. If I create a log on OBJ equals new like so. And now if I do that, I think is valid to say if the boy OBJ is an instance of a call which we know to be false. We should get to the first line because a call OBJ is a car is you know created by the contrast From the car class, and the bike OBJ isn't instance of car because it's an instance of bike. If I reload, we get false. And that's it.
That's when you the instance operator to determine if a particular object is of a certain class. That's it. If you have any questions, feel free to shoot me a message. And as usual, I look forward seeing you in the next video.