0

How to prevent multiple operands in javascript calculator?

Eg: 2++2, when i press "+" more than one time consecutively it should not add another plus sign. below is my code of calculator https://code.sololearn.com/WZMx7gAFYd1M/?ref=app

11th Mar 2018, 9:50 AM
Farhan Farooq
Farhan Farooq - avatar
1 Réponse
+ 12
if (!input.endsWith(op)) { input += op } //like that...
11th Mar 2018, 9:53 AM
Valen.H. ~
Valen.H. ~ - avatar