+ 1
Help with JS code
In the equal.onclick section whatâs wrong? Iâm trying to get the value of the paragraph âcalculationâ and then evaluating that value and putting it in a variable, then changing the text on the paragraph to that number https://code.sololearn.com/WmZ5RN9D8Gkr/?ref=app
3 RĂ©ponses
+ 2
in 40 line try calculationValue = calculation.innerText;
+ 2
(đïŸăźïŸ)đ Good Luck
equal.onclick = () => {
try{
calculation.innerText = eval(calculation.innerText)
} catch(err) {
calculation.innerHTML = ""
console.log("Error: " + err)
}
}
+ 1
Thanks! It works now