News for hackers. Stuff that matters.
Re:How JavaScript Works: deep dive into call, apply, and bind by kevincox on Friday July 09, 2021 @07:06PM (#27789524)
Or simply [...nodeList].map()
Re:How JavaScript Works: deep dive into call, apply, and bind by moron4hire on Friday July 09, 2021 @08:13PM (#27789883)
I don't think you can use splats with a NodeList. At least, the TypeScript compiler complains about it.
Re:How JavaScript Works: deep dive into call, apply, and bind by webstrand on Friday July 09, 2021 @10:53PM (#27790748)
`[ ...document.body.childNodes ]` is legal. You need to have the `DOM.Iterable` enabled in your compilerOptions.libs` for TypeScript to permit it, though.
Re:How JavaScript Works: deep dive into call, apply, and bind by edflsafoiewq on Friday July 09, 2021 @09:37PM (#27790374)
Works for me. Splats work for any iterable.