I cannot understand what is the main difference between map. () and filter.() function. please, someone, explain to me.
filter removes items from an array.
map mutates the items of an array. If you wanted to change all the letters in the alphabet to capitals, you would use
map. If you wanted to take out all the vowels, you would use
map()method creates a new array with the results of calling a provided function on every element in the calling array.
filter() method creates a new array with all elements that pass the test implemented by the provided function.
@ArielLeslie’s explanation is good, just wanted to point out that both actually create a new array - neither modifies the original array.