How to trim string value :: JavaScript Tutorial Aasim Naseem, July 29, 2010 | Read Count: 15,467April 30, 2025 Category: My Tutorials > JavaScript Hi all.. Hope everything is good at your end. Today, there is a small tip for JavaScript users… Umm, in fact, not a tip but a utility function to trim string values… I was working on a project I had a need to trim user input before submitting to server side Here is the quick way to do this . <script type="text/javascript" language="javascript"> function trim(paramString){ return paramString.replace(/^\s*/, "").replace(/\s*$/, ""); } </script> And that’s it… happy development 🙂 Author Profile Aasim Naseem Hey, Thanks for your interest. I’m a PMP, AWS Solutions Architect, and Scrum Master certified professional with 17+ years of hands-on experience leading projects, building teams, and helping organizations deliver software solutions better, faster, and smarter. Outside of work, I’ve got a deep curiosity for history — especially ancient civilizations like Egypt. I also enjoy reflecting on the everyday moments that shape how we live and work. This blog is my space to share insights, lessons, and thoughts from both my professional journey and personal interests. Thanks for reading — and I hope you will find something here that matches your interest. Latest entries IslamJune 6, 2025 | Read Count: 283Economic impact of Eid-ul-Adha PMP CertificationMay 23, 2025 | Read Count: 493Best PMP Study Resources for 2025 (Books, Courses, Tools & More) Agile & FrameworksMay 7, 2025 | Read Count: 463Agile vs Scrum: Finally Understanding the Difference Agile & FrameworksApril 25, 2025 | Read Count: 494When Not To Use Agile: 5 Signs You Need a Different Approach JavaScript How to trim string valuejavascript trimJavaScript TutorialjavascriptsTutorials
JavaScript Document Object Model :: JavaScript Tutorial June 30, 2010 | Read Count: 15,428April 30, 2025 Category: My Tutorials > JavaScriptHello All … Hope everything is going good at your end … today we will explore something about Document Object Model (DOM). From last few days i’m working on javascript and hence i read some good articles about script and dom…i learned alot and now sharing… Read More
JavaScript Event Object :: JavaScript Tutorial July 23, 2010 | Read Count: 15,405April 30, 2025 Category: My Tutorials > JavaScriptHello All … Hope enjoying most enjoyable activity .i.e development 🙂 i love it … really love it .. Today i will try to explain something related to javascript event object. By using JavaScript, we have the ability to create dynamic web pages. Events are actions… Read More
JavaScript Funny JavaScripts :: September 21, 2009 | Read Count: 16,498April 30, 2025 Category: My Tutorials > JavaScript Hey folks … try these codes in address bar of your browser windows and see what happen … javascript:function Shw(n) {if (self.moveBy) {for (i = 35; i > 0; i–) {for (j = n; j > 0; j–) {self.moveBy(1,i);self.moveBy(i,0);self.moveBy(0,-i);self.moveBy(-i,0); } } }} Shw(6) </td javascript:R=0;… Read More