I came across a block of code in a project and I find it hard to understand:
let isSelected = false;
const results = items.filter(Boolean).map(item => {
isSelected = !isSelected && id === item.id;
return {
id: item.id,
name: item.name
};
});
What's the line isSelected = !isSelected && id === item.id; before the return is trying to do?
Thanks.