Thanks to visit codestin.com
Credit goes to www.tutorialspoint.com

Usage of in Operator in JavaScript



The operator is used in JavaScript to check whether a property is in an object or not.

Example

You can try to run the following code to learn how to use in operator in JavaScript −

Live Demo

<!DOCTYPE html>
<html>
   <body>
      <script>
         var emp = {name:"Amit", subject:"Java"};
         document.write("name" in emp);
         document.write("<br>");
         document.write("subject" in emp);
         document.write("<br>");
         document.write("MAX_VALUE" in Number);
         document.write("<br>");
         document.write("MIN" in Number);
      </script>
   </body>
</html>
Updated on: 2020-06-23T07:41:06+05:30

129 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements