Testing if an Object is Iterable

Testing if an Object is Iterable

2,631 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@BR-lx7py
@BR-lx7py - 14.05.2023 17:34

How about doing it with "try":
function isIterable(obj){
try {
for (let i of obj){
return true;
}
}
catch {
return false;
}
return true;
}

Ответить
@tuanminh6442
@tuanminh6442 - 27.02.2023 08:15

great video , can i ask what " DOMContentLoaded" about ?

Ответить
@khalilbenmeziane8836
@khalilbenmeziane8836 - 27.02.2023 02:12

thank you steve

Ответить
@techfth710
@techfth710 - 24.02.2023 14:18

Bob Ross - style teaching , thanks

Ответить
@anasouardini
@anasouardini - 24.02.2023 06:59

good content as always.
one question: why does it have to be a function? is there any other element with the same property except for the type?

Ответить
@kamal1002
@kamal1002 - 23.02.2023 20:43

IS object.keys method more handy than this approach?

Ответить
@nro337
@nro337 - 23.02.2023 16:12

Great video! Very useful knowledge here

Ответить
@thalibmuhammad9519
@thalibmuhammad9519 - 23.02.2023 15:32

why does it iterable when it has [Symbol.iterator] property

Ответить