vanillajs-browser-helpers
Version:
Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS in the browser
16 lines (15 loc) • 310 B
JavaScript
/**
* Find the children of a given DOM element and return it as an Array
*
* @param elm - DOM element to find children from
* @return List of found child DOM elements
*
* @example
*
* ```ts
* children(someDiv);
* ```
*/
export default function children(elm) {
return Array.from(elm.children);
}