c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
JavaScript

How to remove the whitespace from both sides of the string by using JavaScript?

| | Html , JavaScript

In this article we will discuss to remove the whitespace from both sides of the string by using JavaScript. We should use trim() method for removing whitespace.

For example:

<script type="text/javascript">

    var firststring = "infinet ";

    var secondstring = "soft ";

    var result = firststring.trim() + secondstring.trim();

    alert(result);
  </script>