0๐
You can do this easily in your developer console:
x = "12,345.67"
x.replace(/,/g,'') // output: "12345.67"
parseInt(x.replace(/,/g,'')) // output: 12345
I copy-pasted your regexp into my experiment above in developer console. So there is nothing wrong with your usage of replace
.
Now you need to find out if your this.purchase
is a string or some object. Most likely it is an object.
You may use vue-devtools to debug this issue: https://github.com/vuejs/vue-devtools
0๐
It is the same way, no matter u are using vue.js or not.
Source:stackexchange.com