Hello! For example, in order to assign a property to a CSS element via Javascript:
let all = document.getElementsByClassName('class1'); for (let i = 0; i < all.length; i++) { all[i].style.transitionDuration = time + 's'; } // reassign previous variable all = document.getElementsByClassName('class2'); for (let i = 0; i < all.length; i++) { all[i].style.transitionDuration = time + 's'; } // OR // create another variable let all_2 = document.getElementsByClassName('class3'); for (let i = 0; i < all_2.length; i++) { all_2[i].style.transitionDuration = time + 's'; }
Is the difference even relevant?
I think performance meant in time spent to do this operation will be same, but memory consumption will be higher in last example.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
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.
Hello!
For example, in order to assign a property to a CSS element via Javascript:
Is the difference even relevant?
I think performance meant in time spent to do this operation will be same, but memory consumption will be higher in last example.