Instead of using jquery .each()
$('div').each(function(){
You can use document.querySelectorAll() and then convert the HTMLCollection to a JavaScript array. Then you can map an array of elements.
const elems = document.querySelectorAll('.my-elements') const $elems = [].slice.call(elems) $elems.map( (elem) => { console.log(elem) })
steven iseki
source share