Q. Which of the operator is used to test if a particular property exists or not?

  • (A) exist
  • (B) exists
  • (C) in
  • (D) within
πŸ’¬ Discuss
βœ… Correct Answer: (C) in
Explanation:

The in operator is used to test if a property exists in an object or in an array. For example:

let obj = { name: "John", age: 30 };

console.log("name" in obj); // true
console.log("address" in obj); // false

This checks if the property (e.g., "name") is present in the object (obj).

Explanation by: Praveen Singh

The in operator is used to test if a property exists in an object or in an array. For example:

let obj = { name: "John", age: 30 };

console.log("name" in obj); // true
console.log("address" in obj); // false

This checks if the property (e.g., "name") is present in the object (obj).

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
296
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Kirti
Publisher
πŸ“ˆ
96%
Success Rate