Highlight Even Table Rows
JavaScript
Easy
2 views
Problem Description
You have a table with rows inside . Add class even-row to every even row (2nd, 4th, ...).
Output Format
No output (DOM change).
Constraints
Assume there is at least one with .
Official Solution
document.querySelectorAll('tbody tr:nth-child(even)').forEach(tr=>tr.classList.add('even-row'));
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!