var amount = "(21)";
How would I go about just getting the number? I have gotten it to work with...
var amountResult = amount.substring(1, amount.length-1);
...but that just feels incorrect.
What's the better, more flexible way to do this if it were not always surrounded by just 2 characters?
Thanks!
parseInt(amount.substr(1), 10)var amount = "(21)"; var num = new Function("return " + amount + ";")();, but I had to share.var num = eval(amount);-- but yeah, I wouldn't recommend that.