
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
JavaScript Not In Operator for Checking Object Properties
To get only the else part, just negate, using ! the operator in JavaScript. You can try to run the following code to achieve this −
var arr = {}; if (!(id in arr)) { } else { }
In addition, if you want the existence of a property in an object, then use hasOwnProperty −
if (!arr.hasOwnProperty(id)) { } else { }
Advertisements