+ 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 Respostas
+ 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