Last updated 2 years ago
⟩ ⟩ ⟩ ⟩ obj.isIterable
check if an object is .
replit ⟩
- "make-iterator" method name.
- define new properties.
⟩ 12.2 Implementing Iterable Objects
array.isIterable, // true object.isIterable, // false (3).isIterable, // false
Object.defineProperties(Object.prototype, { // ⭐️ obj.isIterable isIterable: { get() { // ⭐️ code copied from the chat bot "chatGPT" return typeof this[Symbol.iterator] === 'function'; } }, }