Help with JS code | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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