I'm trying to filter an array of strings
unfollow(handle: any) {
let following = this.user?.following || [];
following.filter((userHandle) => userHandle !== handle);
console.log(following);
}
I want to filter the array of following in user object but when I console.log(following) the array is unchanged. I tried different things including this this.user?.following?.filter((userHandle) => userHandle !== handle); but nothing is filtered out
this.user?.following = ["ronaldo", "messi"]then for example this user decides tounfollow("messi")so I simply want to update the array by filtering "messi" out