Answers for "javascript remove all whitespace and newlines from string"

23

javascript remove all whitespaces

var spacesString= "Do I have spaces?"; 
var noSpacesString= myString.replace(/ /g,'');// "DoIhavespaces?"
Posted by: Guest on August-01-2019
0

remove spaces and line breaks javascript

const originalString = `
  <div>
    <p>Hey that's <span>somthing</span></p>
  </div>
`;

const strippedString = originalString.replace(/(<([^>]+)>)/gi, "");

console.log(strippedString);
Posted by: Guest on April-15-2021

Code answers related to "javascript remove all whitespace and newlines from string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language