<!DOCTYPE html>
<html>
<body>
<p>Click the button to alert the string with removed whitespace.</p>
<button onclick="myFunction()">Try it</button>
<p><strong>Note:</strong> The trim() method is not supported in Internet Explorer 8 and earlier versions.</p>
<script>
function myFunction() {
var str = " Hello Bos! ";
alert(str.trim());
}
</script>
</body>
</html>
No comments:
Post a Comment