JavaScript에서 공백을 제거하려면 다음 정규식을 실행해 보십시오. 문자열에서 공백을 제거합니다 -
예시
<html>
<head>
<script>
var str = "Welcome to Tutorialspoint";
document.write(str);
//Removing Spaces
document.write("<br>"+str.replace(/\s/g, ''));
</script>
</head>
<body>
</body>
</html> 출력
