Iterable objects
How to make our own iterable object? I don't mean iterators and generators function. For eg, let el = document.getElementsByTagName("div"); The above code returns a iterable object. Weird thing is that, it's not actually instance of array, Array.isArray(el); // false el instanceof array ; // false let mkarr = [...el]; alert(mkarr.pop().innerHTML); //Returns html of last div element How to make our own iterable object? And, possibly, without inheriting Array object https://code.sololearn.com/WZ6y8DltluPg/?ref=app Edit: This way, we can make object iterable by inheriting Array object. Unfortunately, all properties and methods of Array object is now also of car() object https://code.sololearn.com/WT9ReyUdjopb/?ref=app