Search array with pattern in Javascript
-
Hello All I need to search pattern in Array list using Javascript. Like there is one Array which have five value like a[0] = 'apple' a[1] = 'car' a[2] = 'car1' a[3] = 'bike' a[4] = 'office' a[5] = 'computer' i want find those array list which are contain 'ca' character OUTPUT:- like In another array have contain two element like car and car1 can you please help me out how it possible in javascript? Thanks in Advance.
Anish Patel
-
Hello All I need to search pattern in Array list using Javascript. Like there is one Array which have five value like a[0] = 'apple' a[1] = 'car' a[2] = 'car1' a[3] = 'bike' a[4] = 'office' a[5] = 'computer' i want find those array list which are contain 'ca' character OUTPUT:- like In another array have contain two element like car and car1 can you please help me out how it possible in javascript? Thanks in Advance.
Anish Patel
anish27patel wrote:
In another array have contain two element like car and car1 can you please help me out how it possible in javascript?
var result = new Array();
for(var count = 0; cout < mylist.length; count++)
{
if(mylist[count].match("ca"))
result[result.length + 1] = mylist[count];
}Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
anish27patel wrote:
In another array have contain two element like car and car1 can you please help me out how it possible in javascript?
var result = new Array();
for(var count = 0; cout < mylist.length; count++)
{
if(mylist[count].match("ca"))
result[result.length + 1] = mylist[count];
}Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
Thank you
Anish Patel