Javascript regex help please!
Posted: Tue Jan 13, 2015 8:23 pm
I have the following code below in the second function that I am trying to pass jslint. The error is saying "Insecure '.'. (Column: 50). I'm not good with regex and trying to understand it but not having any luck. Any help is greatly appreciated.
Thanks,
Mardonis
Code: Select all
function round2(number) {
return Math.round(number * 100) / 100;
}
Code: Select all
function round2str(number) {
// Force two decimals only:
return round2(number).toString().replace(/(\...).*/, '$1');
}
Thanks,
Mardonis