- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the 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 −
<!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>
Advertisements