pedroapfilho / array-methods

Just a reminder on how to use array methods

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Array Methods

A table of array methods for reference

Method What it does? Code
.filter() filter receives true/false and only puts the true ones on the array filter.js
.find() it finds the first one that returns true and returns all the array find.js
.forEach() forEach runs on each object on the array and does something with it, it doesn't return anything at all forEach.js
.map() map runs on each object on the array and returns something from it map.js
.reduce() reduce will take an accumulator first and secondly the value to accumulate reduce.js
.sort() It sorts the array depending on the arguments sort.js

Here are some examples

Method. What it does? Code
Simple Search What if you want to search for more than one argument? simpleSearch.js
Simple Billing What if you want to know how much is the billing? simpleBilling.js

About

Just a reminder on how to use array methods


Languages

Language:JavaScript 100.0%