{"id":7604,"date":"2025-04-03T06:15:39","date_gmt":"2025-04-03T06:15:39","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=7604"},"modified":"2025-04-03T06:38:25","modified_gmt":"2025-04-03T06:38:25","slug":"how-to-remove-character-from-string-in-javascript","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/","title":{"rendered":"How to Remove Character from String in JavaScript"},"content":{"rendered":"\n<p>JavaScript developers use strings to store texts of information. Often they need to replace or remove one or more characters from the string using JavaScript. In this article, we will learn how to remove character from string in JavaScript.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#How_to_Remove_Character_from_String_in_JavaScript\" >How to Remove Character from String in JavaScript<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#1_Using_Replace\" >1. Using Replace()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#2_Using_ReplaceAll\" >2. Using ReplaceAll()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#3_Using_Split_Join\" >3. Using Split &amp; Join<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#4_Using_Filter_function\" >4. Using Filter() function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#5_Using_for_loop\" >5. Using for loop<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Remove_Character_from_String_in_JavaScript\"><\/span>How to Remove Character from String in JavaScript<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let us say you have the following string &#8216;good morning&#8217;. Here are the different ways to remove character &#8216;o&#8217; from string in JavaScript.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Using_Replace\"><\/span>1. Using Replace()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Every JavaScript string supports replace() function that basically allows you to replace the first occurrence of a character in string. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">string.replace(old_character,new_character);<\/pre>\n\n\n\n<p>To remove a character from a string, you can simply replace it with empty character &#8221;. Here is an example to replace the first occurrence of letter &#8216;o&#8217; in &#8216;good morning&#8217;.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var a = 'good morning';<br>res = a.replace('o','');<br>console.log(res); \/\/ output is 'god morning'<\/pre>\n\n\n\n<p>You can use replace function with string variables as well as literal strings. Here is an example using literal strings.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">res='good morning'.replace('o','');<br>console.log(res); \/\/ output is 'god morning'<\/pre>\n\n\n\n<p>If you want to replace all occurrences of a character then you need to specify a regular expression instead of a literal character by enclosing with within \/&#8230;\/g<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var a = 'good morning';<br>var result=a.replace(\/o\/g,'');<br>console.log(result); \/\/ output is gd mrning<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Using_ReplaceAll\"><\/span>2. Using ReplaceAll()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You can also use replaceAll() function to replace all occurrences of a character or substring in a string. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">string.replaceAll(old_substring, new_substring)<\/pre>\n\n\n\n<p>Here is the example to replace all occurrences of character &#8216;o&#8217; in string.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var a = 'good morning';<br>var result=a.replaceAll('o','');<br>console.log(result); \/\/ output is gd mrning<\/pre>\n\n\n\n<p>If you want to replace only the first occurrence of the character then you need to pick a substring that contains the first occurrence of the character, and replace it with the same expression without the first character. Here is an example to replace only the first occurrence of the character &#8216;o&#8217;.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var a = 'good morning';<br>var result=a.replaceAll('ood','od');<br>console.log(result); \/\/ output is god morning<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Using_Split_Join\"><\/span>3. Using Split &amp; Join<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If there is only one occurrence of a character in string, then you can split the string into substrings using that character as a delimiter, and join the substrings back using empty character &#8221;. If there are multiple occurrences of the character, then all occurrences will be replaced. Here is an example to demonstrate it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var a = 'good morning';<br>var result=a.split('o').join('');<br>console.log(result);<\/pre>\n\n\n\n<p>In the above code, we have used split() function to split the string using &#8216;o&#8217; as delimiter. We have then called join() function on split function&#8217;s result, to concatenate individual substrings into a string. During joining, we have used empty character &#8221;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Using_Filter_function\"><\/span>4. Using Filter() function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Every JavaScript string can be treated as an array. Filter() is a useful function that allows you to filter out all array items that pass a certain test. We can use it to get all characters of a string, except the ones to be removed.<\/p>\n\n\n\n<p>Alternatively, you can filter out the characters to be removed from the array, then join back the remaining array parts back into a string, using join() function. Here is an example to replace all occurrences of letter &#8216;o&#8217; in &#8216;good morning&#8217;.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var a = 'good morning';<br>let c = 'o';<br>let res = Array.from(a)<br>    .filter(char => char !== c)<br>    .join('');<br>console.log(res); \/\/ output is gd morning<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_Using_for_loop\"><\/span>5. Using for loop<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There are some very specific use cases that cannot be easily solved by any of the above solutions. In such cases, it is best to use the good old fashioned for loop to iterate through the string characters one by one and replace character as per your requirement. Let us say you want to replace the 2nd occurrence of letter &#8216;o&#8217; in &#8216;good morning&#8217;. In such cases, it is easy to just loop through the string and replace the character of your choice.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var a = 'good morning';<br>var b = 'o';<br>var result='';<br>var count=0;<br>for (let i = 0; i &lt; a.length; i++) {<br>    if (a[i]==b) {<br>        count++;<br>        if(count==2){<br>            continue;<br>        }<br>        else{<br>            result += a[i];<br>        }<br>    }else{<br>        result += a[i];<br>    }<br>}<br>console.log(result);<\/pre>\n\n\n\n<p>In the above code, we define a result string to store our result, and we loop through our main string. In each iteration, we check if the character is &#8216;o&#8217;. If so, we increment the count variable. If count=2, then we skip the character, else we append it to result string.<\/p>\n\n\n\n<p>As you can see, although this method is a little longer, it allows you to easily handle complex use cases as per your requirement.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt many different ways to remove a character from string. If you want to replace the first occurrence of a string, then you can use replace() function. If you want to replace all occurrences of a character, then either use regular expression in replace() function, or use replaceAll() function. However, if you have a complicated use case such as replacing the 2nd or 3rd occurrence of a character, or removing multiple non-continuous characters then it is better to simply loop through the string, inspect each character and remove\/replace it as per your requirement.<\/p>\n\n\n\n<p>Also read:<\/p>\n\n\n\n<p><a href=\"https:\/\/ubiq.co\/tech-blog\/how-do-i-replace-all-occurrences-of-a-string-in-javascript\/\">How To Replace Occurrences of Substring in JavaScript<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-check-whether-string-contains-substring-in-javascript-2\/\">How to Check Whether String Contains Substring in JavaScript<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-empty-elements-from-javascript-array\/\">How to Remove Empty Elements from JavaScript Array<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes web developers need to remove one or more characters from string. Here is how to remove character from string in JavaScript.<\/p>\n","protected":false},"author":1,"featured_media":7620,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[295],"tags":[404],"class_list":["post-7604","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-remove-character"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Remove Character from String in JavaScript - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Sometimes web developers need to remove one or more characters from string. Here is how to remove character from string in JavaScript.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Remove Character from String in JavaScript - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Sometimes web developers need to remove one or more characters from string. Here is how to remove character from string in JavaScript.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-03T06:15:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T06:38:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/remove-character-string-javascript.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"304\" \/>\n\t<meta property=\"og:image:height\" content=\"203\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Remove Character from String in JavaScript\",\"datePublished\":\"2025-04-03T06:15:39+00:00\",\"dateModified\":\"2025-04-03T06:38:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/\"},\"wordCount\":750,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/remove-character-string-javascript.jpg?fit=304%2C203&ssl=1\",\"keywords\":[\"remove character\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/\",\"name\":\"How to Remove Character from String in JavaScript - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/remove-character-string-javascript.jpg?fit=304%2C203&ssl=1\",\"datePublished\":\"2025-04-03T06:15:39+00:00\",\"dateModified\":\"2025-04-03T06:38:25+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Sometimes web developers need to remove one or more characters from string. Here is how to remove character from string in JavaScript.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/remove-character-string-javascript.jpg?fit=304%2C203&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/remove-character-string-javascript.jpg?fit=304%2C203&ssl=1\",\"width\":304,\"height\":203,\"caption\":\"remove character from string in javascript\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-remove-character-from-string-in-javascript\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Remove Character from String in JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Remove Character from String in JavaScript - Ubiq BI","description":"Sometimes web developers need to remove one or more characters from string. Here is how to remove character from string in JavaScript.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Remove Character from String in JavaScript - Ubiq BI","og_description":"Sometimes web developers need to remove one or more characters from string. Here is how to remove character from string in JavaScript.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2025-04-03T06:15:39+00:00","article_modified_time":"2025-04-03T06:38:25+00:00","og_image":[{"width":304,"height":203,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/remove-character-string-javascript.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Remove Character from String in JavaScript","datePublished":"2025-04-03T06:15:39+00:00","dateModified":"2025-04-03T06:38:25+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/"},"wordCount":750,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/remove-character-string-javascript.jpg?fit=304%2C203&ssl=1","keywords":["remove character"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/","name":"How to Remove Character from String in JavaScript - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/remove-character-string-javascript.jpg?fit=304%2C203&ssl=1","datePublished":"2025-04-03T06:15:39+00:00","dateModified":"2025-04-03T06:38:25+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Sometimes web developers need to remove one or more characters from string. Here is how to remove character from string in JavaScript.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/remove-character-string-javascript.jpg?fit=304%2C203&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/remove-character-string-javascript.jpg?fit=304%2C203&ssl=1","width":304,"height":203,"caption":"remove character from string in javascript"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-character-from-string-in-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Remove Character from String in JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/remove-character-string-javascript.jpg?fit=304%2C203&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-1YE","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/7604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=7604"}],"version-history":[{"count":16,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/7604\/revisions"}],"predecessor-version":[{"id":7621,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/7604\/revisions\/7621"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/7620"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=7604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=7604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=7604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}