komplekt_17,
не для ie!
categories = [{_id:'5d636c50349128976d09806a',catName:'Banking',catClass:'banking',userId:''},
{_id:'5d636c50349128976d09806b',catName: 'Torrents', catClass: 'torrents', userId:''},
{_id:'5d636c50349128976d09806c',catName: 'AudioBooks', catClass: 'audiobooks', userId:''}];
pages = [
{id: 0, name: 'N-0', link: '', ctgrId: '5d636c50349128976d09806a',userId: '',screen:''},
{id: 1, name: 'N-1', link: '', ctgrId: '5d636c50349128976d09806a',userId: '',screen:''},
{id: 2, name: 'N-2', link: '', ctgrId: '5d636c50349128976d09806a',userId: '',screen:''},
{id: 3, name: 'N-3', link: '', ctgrId: '5d636c50349128976d09806c',userId: '',screen:''}]
const getPagesArr = (pages, categories) =>{
const obj = Object.fromEntries(categories.map(({_id, catClass})=> [_id, catClass]));
pages.forEach( el => {
const {ctgrId} = el;
ctgrId in obj && (el.ctgrId = obj[ctgrId])
})
return pages;
}
const newArray = getPagesArr(pages, categories);
console.log(newArray)