How to append array of elements to a Dom
1 min readSep 3, 2019
#from array to Dom
var wrapper = document.createElement('div'),
myClass = document.querySelectorAll('.myClass');myClass[0].parentElement.appendChild(wrapper);
wrapper.id = 'wrapper';for (var i = 0; i < myClass.length; ++i) {
wrapper.appendChild(myClass[i]);
}
#random Array
# make elements array-like
or
shuffle function
function shuffle(array) { array.sort(() => Math.random() - 0.5);}
#ref
https://gist.github.com/kes3583/f3d513e71928426a1fbc729cf9dc5f58