79631407

Date: 2025-05-21 02:21:43
Score: 0.5
Natty:
Report link

Create an array with the classes you need:

const classArray = ['class1', 'class2'];

Then call the add() method from classList using the spread operator to add all classes at once:

element.classList.add(...classArray);
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Rogerio Orioli