0
var all_buttons = document.getElementsByTagName('button');
var copyButtons = [];
for (let n = 0; n < all_buttons.length; n++){
    copyButtons.push(all_buttons[n]);
}
console.log(copyButtons); //Output : [ ]
console.log(all_buttons.length); //Output : 0

I am learning Javascript now I was trying to create a dropdown which will change all buttons colors, for reseting the colors I need to store the original color in an array but I am getting this kind of output, how can I fix this?

0 Answers0