Creating a table using for loops in javascript