Remove String Spaces

Lee·2022년 6월 3일
0

Algorithm

목록 보기
4/92
post-thumbnail

❓ Remove String Spaces

Q. Simple, remove the spaces from the string, then return the resultant string.

✔ Solution

//정규표현식 활용
function noSpace(x){
  return x.replace(/ /g, "");
}
let x = '8 j 8   mBliB8g  imjB8B8  jl  B';

//split(), join() 활용
function noSpace(x) {
  return x.split(" ").join("");
}

Check

profile
Lee

0개의 댓글