So I dont understand why the console logs 1 right away onload or something when i have one.onclick = alterIt(1)
shouldn't it wait till i click one
. Anyway, obviously I am not ver good at javascript, thanks for your help.
window.onload = initialize;
function initialize() {
if (1 == 1){
calculation();
}
}
function calculation() {
var one = document.getElementById('one');
one.onclick = alterIt(1);
}
function alterIt(x) {
console.log(x);
}