Tagged articles

Iterator Protocol

3 articles · Page 1 of 1
IoT Full-Stack Technology
IoT Full-Stack Technology
Jun 18, 2026 · Fundamentals

How to Make var [a, b] = {a:1, b:2} Work in JavaScript?

This article explains why the destructuring statement var [a, b] = {a:1, b:2} throws a TypeError, explores the iterator protocol and Symbol.iterator, and shows how redefining Object.prototype[Symbol.iterator] enables the object to be iterable so the destructuring succeeds.

DestructuringInterview QuestionIterator Protocol
0 likes · 6 min read
How to Make var [a, b] = {a:1, b:2} Work in JavaScript?
IoT Full-Stack Technology
IoT Full-Stack Technology
Jun 17, 2026 · Interview Experience

How to Make var [a, b] = {a: 1, b: 2} Work in JavaScript?

The article explains why the destructuring statement var [a, b] = {a: 1, b: 2} throws a TypeError, details the iterator requirement for the left‑hand side, and shows how to add a Symbol.iterator method to Object.prototype so any object becomes iterable and the assignment succeeds.

DestructuringInterview QuestionIterator Protocol
0 likes · 6 min read
How to Make var [a, b] = {a: 1, b: 2} Work in JavaScript?
Test Development Learning Exchange
Test Development Learning Exchange
Oct 30, 2024 · Fundamentals

Understanding Python Magic (Dunder) Methods: Definitions, Examples, and Best Practices

This article explains Python magic (dunder) methods, their purposes, common examples such as __init__, __str__, __repr__, __len__, __getitem__, __setitem__, __delitem__, __iter__, __call__, __add__, __eq__, __hash__, and shows how to implement operator overloading, iterator and context‑manager protocols while discussing naming rules, performance, inheritance, type checking, and limitations.

Iterator ProtocolPythonSpecial Methods
0 likes · 19 min read
Understanding Python Magic (Dunder) Methods: Definitions, Examples, and Best Practices