+ 1

Final question about the calculator: How do you do the C?

It's supposed to delete the last character, and I don't know how to do it. Pls help! https://code.sololearn.com/W916qpLEF36I/?ref=app

15th Jul 2019, 12:27 AM
Rishan [da_coder, semi-active]
Rishan  [da_coder, semi-active] - avatar
9 odpowiedzi
+ 1
its innerHTML not value, sorry. btw i made a mistake, code above will remove everything but the last 😂 the opposite of C button. here fixed res.innerHTML = res.innerHTML.substr(0, res.innerHTML.length-1);
15th Jul 2019, 12:49 AM
Taste
Taste - avatar
+ 2
Okay
15th Jul 2019, 12:54 AM
Rishan [da_coder, semi-active]
Rishan  [da_coder, semi-active] - avatar
+ 2
IT'S FINISHED! Thank you so much!!!
15th Jul 2019, 12:55 AM
Rishan [da_coder, semi-active]
Rishan  [da_coder, semi-active] - avatar
+ 1
It says it's not a function
15th Jul 2019, 12:41 AM
Rishan [da_coder, semi-active]
Rishan  [da_coder, semi-active] - avatar
+ 1
Can you give me an example of the code your trying to explain?
15th Jul 2019, 12:46 AM
Rishan [da_coder, semi-active]
Rishan  [da_coder, semi-active] - avatar
+ 1
Hmm, do you know how to make it so when you delete everything, it resets to 0 instead of nothing?
15th Jul 2019, 12:52 AM
Rishan [da_coder, semi-active]
Rishan  [da_coder, semi-active] - avatar
+ 1
whats wrong with set it to "0" ? it should work
15th Jul 2019, 12:53 AM
Taste
Taste - avatar
0
maybe str.substr(str.length-1); there may be another way to do it, but thats what i can think of
15th Jul 2019, 12:38 AM
Taste
Taste - avatar
0
in your case its need to be res.value not just res
15th Jul 2019, 12:43 AM
Taste
Taste - avatar