12/08/2018, 17:11

Test lesson 1

function filter ( categoriesList [ ] ) { var resultCounter = 0 ; var resultList = [ ] ; for ( var i = 0 ; i < db . length ; i ++ ) { categoriesList . forEach ( elem => { if ( db [ i ] . type . join ( ...

function filter(categoriesList[]) {
     var resultCounter = 0;
     var resultList = [];
     for (var i = 0; i < db.length; i++) {
         categoriesList.forEach(elem => {
             if (db[i].type.join(",").indexOf(elem)>=0 && resultList[i] != resultList[i-1]) {
                 resultList[0] = db[i].id;
                 resultList++;
             }
         })
     }
     for (var i in resultList) {
         addItem(resultList[i], 0);
     }
                            
}
0