+ 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

5th Jan 2023, 6:37 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
3 RĂ©ponses
+ 2
in 40 line try calculationValue = calculation.innerText;
5th Jan 2023, 7:18 PM
meri
+ 2
(đŸ‘‰ïŸŸăƒźïŸŸ)👉 Good Luck equal.onclick = () => { try{ calculation.innerText = eval(calculation.innerText) } catch(err) { calculation.innerHTML = "" console.log("Error: " + err) } }
5th Jan 2023, 7:17 PM
SoloProg
SoloProg - avatar
+ 1
Thanks! It works now
5th Jan 2023, 7:26 PM
MyNameIsNotBob
MyNameIsNotBob - avatar