const toFloat = str => {
let val = str.replace(/[^0-9,.]/g, '');
return val.split('').reduce((str, num) => {
if ([',', '.'].includes(num)) {
if (str.indexOf(',') !== -1 || str.indexOf('.') !== -1) return str;
if (!str) str += '0';
}
return (str += num);
}, '');
};
console.log(
toFloat('0.00s1'), //0.001
toFloat('.0!20'), //0.020
toFloat('1,.20') //1,20
);