Consider a non-DOM scenario where you\'d want to remove all non-numeric characters from a string using JavaScript/ECMAScript. Any characters that are in range 0 - 9
0 - 9
we are in 2017 now you can also use ES2016
var a = 'abc123.8'; console.log([...a].filter( e => isFinite(e)).join(''));
or
console.log([...'abc123.8'].filter( e => isFinite(e)).join(''));
The result is
1238