79239529

Date: 2024-11-30 12:28:48
Score: 0.5
Natty:
Report link

You should use classList, not setAttribute:

const p = document.createElement('p');
p.classList.add("your-class");
// do whatever you need with the new p

Replace the your-class with the class that you need to add.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Petəíŕd the Wizard