While experimenting with Array.filter, I made an interesting discovery. By forgetting to include an equality check, my array was unexpectedly mapped instead of filtered. Here is the code snippet that led to this result:
const x = [{ name: 'user' }];
console.log(x.filter(x => x.name = 'another user'))
// Result:
// [{ name: 'another user' }]
Has anyone else experienced this behavior before? I couldn't find any documentation on Array.filter behaving like Array.map as well. Could this be a feature or a bug? Perhaps I should report this on GitHub for further clarification...