Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 722 Bytes

File metadata and controls

39 lines (27 loc) · 722 Bytes

Task

Convert the following code from a for-loop to Array#map:

function doubleAll(numbers) {
  var result = []
  for (var i = 0; i < numbers.length; i++) {
    result.push(numbers[i] * 2)
  }
  return result
}

module.exports = doubleAll

Arguments

  • numbers: An Array of 0 to 20 Integers between 0 and 9

Conditions

  • Your solution should use Array.prototype.map()
  • Do not use any for/while loops or Array.prototype.forEach.
  • Do not create any unecessary functions e.g. helpers.

Resources

Boilerplate

function doubleAll(numbers) {
  // SOLUTION GOES HERE
}

module.exports = doubleAll