I have a calculator that works something like this:
[bolas][+][preco da bola]
I scan the string by replacing [XXXXXXX] with the corresponding value and use eval to perform the calculation. But there may be cases of error when for example the calculation looks like this:
eval("5 + [preco da bola]");
- The JS code for when this error occurs?
- If the code stops, can I prevent this so that it keeps running?
- Can I detect the error and send a custom alert?