πŸ“Š JavaScript
Q. The enumeration order becomes implementation dependent and non-interoperable if:
  • (A) The delete keyword is never used
  • (B) Object.defineProperty() is not used
  • (C) If the object inherits enumerable properties
  • (D) The object does not have the properties present in the integer array indices
πŸ’¬ Discuss
βœ… Correct Answer: (C) If the object inherits enumerable properties

Explanation:

In JavaScript, the enumeration order of object properties is well-defined for own properties but can become implementation-dependent and non-interoperable when inherited properties (i.e., properties from the prototype chain) are enumerable.

  • If an object inherits enumerable properties, their enumeration order is not guaranteed to be consistent across different JavaScript engines.
  • Different JavaScript engines (like V8, SpiderMonkey, and Chakra) may handle the order of inherited properties differently, leading to inconsistencies in enumeration order.

Thus, option (C) is correct.

Explanation by: Mr. Dubey

In JavaScript, the enumeration order of object properties is well-defined for own properties but can become implementation-dependent and non-interoperable when inherited properties (i.e., properties from the prototype chain) are enumerable.

  • If an object inherits enumerable properties, their enumeration order is not guaranteed to be consistent across different JavaScript engines.
  • Different JavaScript engines (like V8, SpiderMonkey, and Chakra) may handle the order of inherited properties differently, leading to inconsistencies in enumeration order.

Thus, option (C) is correct.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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