If I have an array of movie objects like this:
const movies: Movie[] = [ movie1, movie2, movie3, movie4 ];
And if I want to remove a specific movie from the array, such as movie2, I can use the following code:
movies = movies.filter( m => m !== movie );
I tried using a block statement within the arrow function to achieve the same result but it didn't work:
movies = movies.filter( m => {
m !== movie;
});
Can someone explain the difference between these two approaches?