I created a HTMLCollection
by using the method document.getElementsByClassName
and I know that it returns an Object. But when I converted that object into Array using the Array.from
method and then checked its type, it still shows the type as of Object
.
While I'm able to perform the array operations upon the same.
Asked
Active
Viewed 16 times
0

himank
- 21
- 4
-
3Arrays **are** objects. Even if you do `typeof []` you'll get the same result. If you want to test whether an array is an array instead of any other data type, then use `Array.isArray()`. – Daedalus Sep 02 '23 at 05:46