For my Javascript assignment I have to make a slot machine.
The one part I can't get is adding my totalCredits Variable to my textfield.
It just puts the variable beside the credits instead of adding them. (want to add 30 + 2 but I get 302)
I have tried parseFloat and parseInt both give me "ReferenceError: invalid assignment left-hand side"
This is the function
function checkForWin() {
if (bet1 == true && symbols[rng1].color == symbols[rng2].color && symbols[rng2].color ==
symbols[rng3].color && symbols[rng1].color == symbols[rng3].color) {
document.getElementById("message").innerHTML = "Same Color You Win 2 Credits";
totalCredits = totalCredits + 2;
parseInt(document.getElementById('credits').value) = totalCredits;
console.log(totalCredits);
};
parseInt(document.getElementById('credits').value) = totalCredits;totalCredits = parseInt(totalCredits) + 2;anddocument.getElementById('credits').value = totalCredits;