'How do I get the answers on the table using vanilla JS?

I am trying to get the answers in the table and am unsure how to do so using only Javascript. No JQuery https://jsfiddle.net/4yxz39gk/

const grid=document.querySelector(".grid")
const smallgrid=document.querySelector(".grid-small")
let num = []
let times= []

function arr(){
    for (let i=0; i<169; i++){
       let small=document.createElement("div")
       grid.appendChild(small)
       num.push(small)
       
        num[i].classList.add("grid-small")
      
      
      
    }
       
     
    
}

arr()


function time(){
    for(let i=1; i<13; i++){
        for(let j=1; j<13; j++){
            let result = i*j
            times.push(result)
            
        }
    }
}
time()
console.log(times)

How do I add my answers to my table! Any help is much appreciated.

Thanks



Solution 1:[1]

I don't know if this is exactly what you want.

function time(){
    let index = 0;
    for(let i=1; i<=13; i++){
        for(let j=1; j<=13; j++){
            index++;
            let result = i*j
            times.push(result)
            document.querySelector(`.grid > div:nth-child(${index})`).textContent = result
        }
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 digitalniweb