I have an array of object like this
let arr = [{
user: 1,
details: 'sample' },
{
user: null,
details: 'sample' },
{
user: 3,
details: 'sample' }];
I want to filter out the null user. But when I tried to map the array I get this result.
[user1, [], user3]
I want to get rid of the []
so I can get the correct data and length. How can I achieve this in Javascript?