Monthly Archive: March 2017

0

How to get the number from the middle of a string

Given the following string extract the number ‘Buy for $199.99’ // 199.99 ‘Gas Price $2.304 per gallon’ // 2.304 We can solve this using slice and, parseFloat(). slice returns the string from the starting...