I am writing an animation and I want to add class to the divs that are being created each time in the for loop but every time
const canvas = document.getElementById("canvas");
function divCreater() {
for (let i = 0; i < 100; i++) {
document.createElement("div");
let div = document.querySelectorAll("div");
div.addClass('div');
div.width = "(Math.random()*10)px";
div.height = "(Math.random()*10)px";
canvas.appendChild("div");
}
};
divCreater();
I get the error that addClass is not a function