We want to make this open-source project available for people all around the world.

Help to translate the content of this tutorial to your language!

back to the lesson

Select all diagonal cells

importance: 5

Write the code to paint all diagonal table cells in red.

You’ll need to get all diagonal <td> from the <table> and paint them using the code:

// td should be the reference to the table cell
td.style.backgroundColor = 'red';

The result should be:

Open a sandbox for the task.

We’ll be using rows and cells properties to access diagonal table cells.

Open the solution in a sandbox.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.