|
|
|
|
|
by sandrot
1861 days ago
|
|
Try using Array.from(arrayish).forEach() to convert the thing that looks like an array to an actual array. For instance, you can't use map() on a NodeList (document.querySelectorAll returns a NodeList), so you have to use Array.from(NodeList) to first convert it to an array. |
|
Spread syntax is my goto for that:
But, it being JavaScript, there’s probably a subtle distinction in where Array.from(arrayish) works and where [...arrayish] works.