JavaScript in and instanceof operators Last Updated : 14 Nov, 2025 Comments Improve Suggest changes Like Article Like Report In JavaScript, the in and instanceof operators are used to check relationships within objects and classes.The in operator checks whether a property exists in an object or an index exists in an array.The instanceof operator checks whether an object is an instance of a specific class or constructor.Both operators return a Boolean value (true or false) based on the result of the check.JavaScript in OperatorThe in-operator in JavaScript checks if a specified property exists in an object or if an element exists in an array. It returns a Boolean value. JavaScript let languages = ["HTML", "CSS", "JavaScript"]; // true (index 1 exists in the array) console.log(1 in languages); // false (index 3 doesn't exist in the array) console.log(3 in languages); Outputtrue falseExample-Using in with Objects: JavaScript const Data = { name: "Rahul", age: 21, city: "Noida" }; // true ("name" property exists in the object) console.log("name" in Data); // false ("gender" property doesn't exist in the object) console.log("address" in Data); Outputtrue falseJavaScript instanceof OperatorThe instanceof operator in JavaScript tests if an object is an instance of a particular class or constructor, returning a Boolean value. JavaScript let languages = ["HTML", "CSS", "JavaScript"]; console.log(languages instanceof Array); console.log(languages instanceof Object); console.log(languages instanceof String); console.log(languages instanceof Number); Outputtrue true false falseExample–Using in with Objects: JavaScript let myString = new String(); let myDate = new Date(); console.log(myString instanceof Object); console.log(myString instanceof Date); console.log(myString instanceof String); console.log(myDate instanceof Date); console.log(myDate instanceof Object); console.log(myDate instanceof String); Outputtrue false true true true false Create Quiz Comment V vishalkumar2204 Follow 0 Improve V vishalkumar2204 Follow 0 Improve Article Tags : JavaScript Web Technologies javascript-operators Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings5 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in JavaScript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)8 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readScope of Variables in JavaScript3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like