I need help with my % button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I need help with my % button

I need help with my % button in my calculator

11th Apr 2021, 2:59 PM
Raidel González Cabrera
Raidel González Cabrera - avatar
7 Answers
+ 3
Hi, you already have code needed to do % calculation. so you don't need percent function. Change line 15, <button onclick="percent()">%</button> to <button onclick="add('%')">%</button> and remove function percent(key) cause it brings syntax error If you do that button % will work and will get result with function calc() hope that helps
11th Apr 2021, 4:01 PM
Wilbur
Wilbur - avatar
11th Apr 2021, 3:02 PM
Raidel González Cabrera
Raidel González Cabrera - avatar
+ 1
https://code.sololearn.com/WQ6isIZ2pR2b/?ref=app try like this.
12th Apr 2021, 6:28 PM
Mehran
Mehran - avatar
0
You have not closed the opened bracket after innerHtml à line 24. Close it and run your program.😉
11th Apr 2021, 3:48 PM
Joyce Bissa
Joyce Bissa - avatar
0
Thanks, but it doesn't work
11th Apr 2021, 4:06 PM
Raidel González Cabrera
Raidel González Cabrera - avatar
0
Yeah but I need that 5%=0.05
11th Apr 2021, 4:41 PM
Raidel González Cabrera
Raidel González Cabrera - avatar
- 2
Is it not working. I see from code button % is working
11th Apr 2021, 4:39 PM
Wilbur
Wilbur - avatar