I have the following:
var arr = [{id: 0, title: 'This is a test Hello World Hello'}, {id: 1, title: 'I like the World'}, {id: 2, title: 'The Sun is bright'}, {id: 3, title: 'Cat'}],
replaceMents = ['Hello', 'World'];
I would like to have the array like that after the replacement:
[{
id: 0,
title: 'This is a test'
}, {
id: 1,
title: 'I like the'
}, {
id: 2,
title: 'The Sun is bright'
}, {
id: 3,
title: 'Cat'
}]
As I don't want to use a classical arr.forEach, I'm searching for a nicer solution.
Which possibilities are there ?
I thought something like
var newArr = arr.map(el => replaceMents.forEach(rep => el.title.replace(rep, '')))