Why does not the code and no errors?

let inputID;
let nam;

let divID = document.getElementsByClassName("div");
let dd = document.getElementsByClassName("dd");
let btn1 = document.getElementById("btn");
inputID = 0;
nam = 0;

btn1.onclick = function() {
 divID.innerHTML = nam;

In the console output and div no, why?
April 7th 20 at 15:15
1 answer
April 7th 20 at 15:17
document.getElementsByClassName("div") most Likely returns an array of elements with class div. Therefore write something like divID[0].innerHTML = nam;
But most likely You shouldn't use getElementsByClassName, here it is more logical to use getElementById and assign the div an Id attribute

Find more questions by tags JavaScript