-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
  • 43
  • 5

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,848
  • 24
  • 98
  • 145
0

That's called Vanilla Javascript

An example

var myArray = document.getElementsByClassName('myClass')

myArray will be a HTMLCollection

João Pimentel Ferreira
  • 14,289
  • 10
  • 80
  • 109