var values = ["50.00024+40.04005+0.1", "0050.00024+040.04005+0.1"];
for (var i=0; i<values.length; i++) {
if(values[i].indexOf('+')>0 || values[i].indexOf('-')>0 || values[i].indexOf('*')>0 || values[i].indexOf('/')>0){
try{
var evaluated = eval(values[i]);
if(typeof evaluated === 'number'){
console.log(evaluated);
}
}catch (e){
console.error(e)
}
}
}
I have some math actions, it's could be plus, minus or other actions, and I need to take result for this actions. I use eval for this. But if I have zero before number like 005,75 eval is not working. How can I calculate this?