DEV Community

tallen15s
tallen15s

Posted on

Filter and Map...

How exactly does a map function work>>?? Map takes two arguements and then the callback will run through the entire array and then it will return a new value for each item in the array. Thus resulting in a new array. Filter on the other hand is different. If you have an array and only want to few specific things from it and don't need the rest. This is the function that you would use. It takes information from your current array that returns "true", if it doesn't return as true, then it won't be filtered. It will create a new array and not change the first one. This is what we learned last week and it took me till today to remember all of that.

Top comments (0)