+ 3
Probably because the calculator on your phone does not just consist of one eval. It can probably be resolved with regular expressions
1st Jul 2019, 11:11 AM
Airree
Airree - avatar
+ 4
Why would it be the same?
1st Jul 2019, 10:09 AM
Airree
Airree - avatar
+ 3
Well, that's because the input is invalid. That is pretty obvious, I thought you would know that. But you can still catch the error though
1st Jul 2019, 9:24 AM
Airree
Airree - avatar
+ 3
try { calMo.value = eval(calMo.value); } catch (e) { calMo.value = "Invalid input!"; } Seriously, you don't know this?
1st Jul 2019, 9:29 AM
Airree
Airree - avatar
+ 3
Well, I have never heard of that. Maybe you could do it with regular expressions, but I don't think you need multiple possibilities for multiplication in a simple calculator.
1st Jul 2019, 10:17 AM
Airree
Airree - avatar
+ 3
~ swim ~ Yes, I heard of that, but I was talking about 2(2.
1st Jul 2019, 10:25 AM
Airree
Airree - avatar
+ 2
You start evaluating from there first. But I don't get why you are asking this, since it works perfectly. eval does that by default
1st Jul 2019, 9:20 AM
Airree
Airree - avatar
+ 1
Mofey I can't help you, since a) this is your project, not mine, and b) I couldn't help even if I wanted to, because I have never used regular expressions seriously
1st Jul 2019, 12:13 PM
Airree
Airree - avatar
1st Jul 2019, 12:29 PM
Airree
Airree - avatar