-4

hey would love to have a take from a more experienced coder about this.

Would appreciate if you could give it to me in the below code format, thanks a lot

Hey
  • 13
  • 3

2 Answers2

0

You could use document.querySelectorAll.

This returns a Node List, to convert that to an Array, you could do

const elements = [...document.querySelectorAll(".my-selector")];
martincarlin87
  • 10,397
  • 24
  • 97
  • 143
0

That's called Vanilla Javascript

An example

var myArray = document.getElementsByClassName('myClass')

myArray will be a HTMLCollection

João Pimentel Ferreira
  • 11,565
  • 7
  • 67
  • 91