How implement a “ReplaceAll” functionality in JavaScript

A common problem that I has been worked and I always forget it is that JavaScript does not have a “ReplaceAll” function, so I simple way to fix it is with a next snip of code that replace all occurrences of a blank space:

var myVar = "Hello Word";
myVar = myVar.split(" ").join("");
alert(myVar);

Analista/Desarrollador y cofundador de QBit Mexhico. Tecnologías utilizadas Android, Java (EJB, Servlets, Faces, Groovy & Grails, Maven, Swing), .Net (C#, VB, ASP, MVC), Delphi, Spring, Hibernate, DTSx, Oracle, T-SQL, Firebird, MySQL, MongoDB, NodeJs, ReactJs (Flux). Sistemas Operativos Mac, Ubuntu y Windows.

Twitter LinkedIn 

Compartir en...Tweet about this on TwitterPin on Pinterest0Share on LinkedIn0Share on Google+0Share on Facebook0