Got it. So, copying the HTMLCollection into a new array using Array.from() also copied all of the references to the original, thus changes to the copy reflected back to the DOM. That seems convenient and dangerous at the same time.
This is the nature of working with DOM elements, don't know if I'm just used to it. It's very reference-y and with a bunch of side-effects, I believe that's why we use libs like React, since we almost don't have to deal with this.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Got it. So, copying the
HTMLCollection
into a new array usingArray.from()
also copied all of the references to the original, thus changes to the copy reflected back to the DOM. That seems convenient and dangerous at the same time.Yeah, right!
This is the nature of working with DOM elements, don't know if I'm just used to it. It's very reference-y and with a bunch of side-effects, I believe that's why we use libs like React, since we almost don't have to deal with this.