Hackerss.com

hackerss
hackerss

Posted on

Javascript Reemplazar guiones por espacios


//Reemplazar guiones por espacios

//function to replace dashes with spaces
function replaceDashes(str) {
  // return the string with dashes replaced by spaces
  return str.replace(/-/g, " ");
}

//example
const result = replaceDashes("hello-world");

//output
console.log(result); //hello world


Enter fullscreen mode Exit fullscreen mode

Top comments (0)