Below is the function I wrote for step 112 of “Learn Basic Javascript By Building a Role-playing Game”. My question is: if “fighting = 0;” is used to reference the “slime” object in my “monsters” array, how does the computer know to pull from the monsters array instead of another object array like “weapons” for example? Is it because function goFight will tell it which array to reference?
function fightSlime() {
fighting = 0;
goFight();
}
I know this is a noob question that will probably be answered by the other steps in the course but I just have to know.