I know there is so much topic with this subject but none of those topics solved my problem.
I have a javascript code and there is several function in it, after about an hour I finally found all function that is defined under a special function doesn't work and the error "ReferenceError: Can't find variable: functionName" will appear and all the other that is defined on top of that special function is work properly. My problem is that I can't find out what's wrong with this special function that causes this problem ... can anyone help me ?
Here is that special function :
function shift(btn) {
if (!shiftPressed) {
document.getElementById("keyShift1").style.background = "rgb(180,50,0)";
document.getElementById("keyShift2").style.background = "rgb(180,50,0)";
for (var i = 65; i <= 90; i++) {
var id = "key" + String.fromCharCode(i);
document.getElementById(id).innerHTML = document.getElementById(id).value.toUpperCase();
}
document.getElementById("key~").innerHTML = "`";
shiftPressed = !shiftPressed;
} else {
document.getElementById("keyShift1").style.background = "black";
document.getElementById("keyShift2").style.background = "black";
document.getElementById("key~").innerHTML = "~";
if (!capsPressed) {
for (var i = 65; i <= 90; i++) {
var id = "key" + String.fromCharCode(i);
document.getElementById(id).innerHTML = document.getElementById(id).value.toLowerCase();
}
}
shiftPressed = !shiftPressed;
}