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() ?
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
b. If words you want to remove can be anywhere in the string
c. There is one more lame way to do this.
d. using simple regex to replace multiple words
based on your need you can go for any one of them.
references : this , this and this