javascript - How To Do Two Times String Charachets Replace/Remove at Once -


i have text string "1,000 kw" as

var result = "1,000 kw" 

can please let me know how can clean display 1000 on 1 line? tried replace() as:

 var res1 = result.replace(',','');  var res2 = res1.replace(' kw','');  alert(res2); 

which working need have code in 1 line. thanks

use regex replace that's not numbers nothing

var res1 = result.replace(/\d/g,''); 

fiddle


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -