 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to remove “,” from a string in JavaScript
We are given a main string and a substring, our job is to create a function shedString() that takes in these two arguments and returns a version of the main string which is free of the substring.
For example −
shedString('12/23/2020', '/');
should return a string −
'12232020'
Let’s now write the code for this function −
Example
const shedString = (string, separator) => {
   //we split the string and make it free of separator
   const separatedArray = string.split(separator);
   //we join the separatedArray with empty string
   const separatedString = separatedArray.join("");
   return separatedString;
}
const str = shedString('12/23/2020', '/');
console.log(str);
Output
The output of this code in the console will be −
12232020
Advertisements
                    