Homework
JavaScript Iterators
.forEach() or .filter()
.forEach() or .filter()
Write a function named onlyEven that returns evens numbers in an array.
.forEach() or .filter()
.forEach() or .filter()
countIntegers
– counts how many integers there are in an array
Hint: Google how you can check if a number is an integer in JavaScript
.map()
oldie but goodie
.map()
oldie but goodieWrite a function lengths
that accepts a single parameter as an argument, namely an array of strings. The function should return an array of numbers where each number is the length of the corresponding string. use .map
.map()
.map()
Write code using .map()
to have the following input and output:
getSquares
– takes in an array of numbers and returns an array of their squares
.map(), .filter() & .reduce()
.map(), .filter() & .reduce()
Write an expression using array iterator methods (like filter and reduce) to compute the total value of the machines in the inventory array.
Get an array of all the machines with value over 500
Last updated
Was this helpful?