I have this script written
const termList = document.querySelectorAll('.term');
const randomNum = Math.random()*(termList.length-0)+0;
const randomTerm = termList[randomNum];
I want to have randomTerm
pull out a random <div>
out from that array that has that class. As written however randomTerm
when run in the console simply produces undefined
.
Do I need to have the NodeList
array created by termList
be exported into a non NodeList
array?
Thanks!