11 Replies Latest reply on Sep 6, 2010 11:57 PM by Marijan Tompa [tomaxxi]

    Multiple replaces with JS

    Fred Goldman Level 3

      Is there anway to make multiple replaces in JS wihtout having to continually restore the results in a new variable? Currently this is the way I am doing it:


          var myContents = myContents.replace(/ +/g," ")
          var myContents = myContents.replace(/\|vertsb\|/g,"")
          var myContents = myContents.replace(/\|icrl\|/g,"")
          var myContents = myContents.replace(/\|wspon\|/g,"")


      Is it possible without having to overwrite the old myContents variable? This is strictly a performance question. I am trying to make the script faster.