consider function seletcolor()
below:
function seletcolor() {
var button = document.querySelector("button");
var a = 1;
button.onclick = function (e) {
a = a++;
};
console.log(a);
}
Once I click on button, I want to print out the value of the variable a
inside the event outside the event.