Arrays and array methods
Arrays and array methods
Arrays are ordered collections. push and pop change the end; map transforms values; filter selects values; find locates one value; reduce combines values. Prefer methods that communicate intent instead of complex manual loops.
Try it yourself
Change the example, run it, and explain the result in your own words. Then create one variation of your own.
Key idea
Use the example as a starting point, not something to memorize. Practise, inspect the result and make small improvements.
Code example
const prices = [10, 20, 30];
const withTax = prices.map(price => price * 1.075);
console.log(withTax);