Answer the question
In order to leave comments, you need to log in
Add a return statement to this callback Sonarlint?
Object.entries(items).map(element => {
if (commentId === element[1].id) {
items.splice(element[0], 1);
}
});
Answer the question
In order to leave comments, you need to log in
map should return some value for the new array, like:
const newArray = oldArray.map(value => {
return value * 2;
});
const idx = items.findIndex(comment => comment.id === commentId);
if (idx > -1) {
items.splice(idx, 1);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question