Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8964217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:32:15+00:00 2026-06-15T16:32:15+00:00

can i give more than one parameter to the split function in javascript to

  • 0

can i give more than one parameter to the split function in javascript to remove more than one thing and put it into array? for expamle:

 var str= "This is Javascript String Split Function example ";

 var wordArray=str.split(" ");

this will give me each word separately

in addition of this result, i want to remove “is” and “this” from the array, so can i put in the split function many parameter to remove from the beginning ” “ & “is” & “this” ? or should i use another function than split() ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:32:16+00:00Added an answer on June 15, 2026 at 4:32 pm

    there are many ways to achieve what you want. Basically you want to remove is and this

    so either you can do this:

    a. If words you want to remove are always the first and the second one then

     var filteredArray = str.split(" ").splice(2);
    

    b. If words you want to remove can be anywhere in the string

    var  filteredArray = str.replace(/this|is/g, function(w){
    
            switch(w){
               case 'this':
                     return '' ;
    
                  case 'is':
                       return '';
              }
    
        }).trim().split(' ');
    

    c. There is one more lame way to do this.

    var str= "This is Javascript String Split Function example ";
    var parts = str.split(' ');
    var clean = [];
    for (var i = 0; i < parts.length; i++) {
       var part = parts[i];
       if (part !== "This" && part !=="is")
          clean.push(part);
    }
    

    d. using simple regex to replace multiple words

    var str= "This is Javascript String Split Function example ";
       var words = ['This', 'is'];
       var text = str.replace(new RegExp('(' + words.join('|') + ')', 'g'), '').split(' '); 
    

    based on your need you can go for any one of them.

    references : this , this and this

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application I validate emails; but we can give more than one email
Can someone give an example for finding greatest common divisor algorithm for more than
How can I use SetProcessAffinityMask to select more than one logical processor? In Windows
Can anyone tell or define more what is ancestor and give an example on
It appears that NHibernate cannot automap more than one IList of a given type
I have to implement a spring security piece which has more than 1 parameter
Using VB.Net and C#.Net. For Example Am Using More than one form If am
I'm trying to add more than one countdown timer with the same date on
I have an application which I need to have work in more than one
On more than one occasion I have found myself desiring a variable visibility that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.