html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html>
<head>
<title>Remove String Spaces</title>
</head>
<body>
<!--
Remove String Spaces
Just remove string spaces and return output without spaces.
For example:
string = "ab c d e fgh i j kl mn opqr stuvwxy z"
result = "abcdefghijklmnopqrstuvwxyz"
-->
<h1 align="center">
Remove String Spaces
</h1>
<h2>Your old String: </h2>
<span id="span1"></span>
<hr />
<h2>Your new String without spaces: </h2>
<span id="span2"></span>
<script>
document.getElementById("span1").innerHTML = myString;
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
body {
}
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
var myString = prompt("Write a String to remove all Spaces.");
var result = "";
if(myString !== null)
for(i = 0; i < myString.length; i++) {
if(myString[i] === " ") {
}else {
result += myString[i]
}
}
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run