repl.it
@Tyledelphia/

convertDoubleSpaceToSingle

JavaScript

No description

fork
loading
main.js
1
2
3
4
5
6
7
8
9
10
function convertDoubleSpaceToSingle(str) {
  let wordsArray = [];
  let array = str.split('  ');
  str.split(' ');
  array.push(wordsArray);
  let newString = wordsArray.join(' ');
  return newString;
}

convertDoubleSpaceToSingle('The  Quick  Brown  fox  jumps  over  the  lazy  dog');
Native Browser JavaScript