[js] Replace a string multiple times

eg:  var str="icon icon-1chkedchkedchked";

  var strNew=str.replace(new RegExp("chked","gm"),"") 

returns the result strNew after replacing the string "chked" multiple times as "icon icon-1":

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326358055&siteId=291194637