DEV Community

Discussion on: Daily Challenge #276 - Unwanted Dollar Signs

Collapse
 
a3 profile image
Ajay

Javascript

const convert = string => parseFloat(string.replace(/[^0-9.]/g, ''))
Collapse
 
fatalchemist profile image
fatalchemist

fails on negative values, due to replacing the '-'