Filter array based on other search array

how to filter with signsNames array the filtered array? so I have the 38 meshes

var signsNames = 

var regex = /Default/g;

var filtered =  this.meshes.filter(function(mesh){
        var matName =;

        var matching = matName.match(regex);

        return matching;


var test = filtered.filter(function(mesh){
        return signsNames.includes(mesh);

the equivalent of manually doing if(sth === name){
else if (sth === name2){}

Hi @grzesiekmq,

If you mean how to find the index of an array item based on its name, something like this:

var itemIndex = signsNames.indexOf(name);
if( itemIndex > -1){
   // item found

sth like this but not working
the element of array as parameter in .includes

        n = name;

 var filSigns = signsMeshes.filter(function(mesh){


If you mean replacing the ES6 filter method with an ES5 equivalent, then use a regular loop and indexOf:

var filteredList = [];

signsNames.forEach( function(name){
    if( > -1 ){
1 Like

hmm I mean sth like this"mj_oomiya_y");"mj_kuukoucyuuou_y_01");

but as parameter how to pass item from array to .includes?


In the code I posted above param is name, so it’s passed each time to indexOf > -1. Which does the same check as the includes method you mention.

Unless you are trying to do something different, and I don’t get you here :slight_smile: