जावास्क्रिप्ट में स्पेस हटाने के लिए, आप निम्नलिखित रेगुलर एक्सप्रेशन चला सकते हैं। यह स्ट्रिंग से स्पेस हटा देता है:
उदाहरण
<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>आउटपुट
