A

Admin • 833K Points
Coach

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

  • (A) exist
  • (B) exists
  • (C) in
  • (D) within
  • Correct Answer - Option(C)
  • Views: 29
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin

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).

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.