Grid

Mark Cena
Mark Cena
Sep 3, 2018 · 1 min read

Hello, I would like to show you the Grid activity which was given to us. I found it too hard, it took us almost a month to finish this activity. We got stuck up in the javascript, We didn’t know what we’re going to do so they gave us an idea of what we will going to do. Day by day we’re progressing even though it took us a long time. This Grid gave us too much confusion, like in the loop if your condition is wrong it will not function.

Here are some codes I have in my javascript

while ( i<td.length){td[i].style.backgroundColor="";i++;}

This loop was used to fill out the recent color of the table.

This is the function of that loop.

We’ve been told that they dont want to see multiple copy of variable in the loop, so we use a function.

function color(){cell = document.querySelector('tr:nth-of-type('+y+') td:nth-of-type('+x+')');cell.style.backgroundColor = 'red';

We used it in every loop.

Here is the finished work of my grid activity.