So my anomaly is this: I am passing an integer value 'g' to my 'turn' function inside my .addEventListener
, for some reason, when the integer comes out on the other side through the document.getElementById("score").innerHTML=j
line, it displays the sting 'length' when I fully expected the integer I passed in initially, why is this doing this?
var initials=document.getElementsByClassName("letter")
function load(){
for(var g in initials)
{
initials[g].addEventListener("click", function(){turn(g)})
initials[g].innerHTML=alpha[Math.floor(Math.random()*alpha.length)]
document.getElementById("score").innerHTML="thischanged "+g
}
}
function turn(j){
document.getElementById("score").innerHTML=j
}