Double Each Value (Set 7)

Easy

Given an array of integers nums, return a new array where every value has been multiplied by 2.

Double Each Value (Set 7) — the data. This set runs 4 cases: nums holds arrays of 28–48 items, with values from -59 to 70. The hidden cases are the largest of the set.

Example 1

doubleEach()
Input
nums = [58, 16, -1, 44, -44, -55, 13, 23, -25, 41, 67, 57, 41, -1, 3, -33, 36, 14, -20, 31, -46, -36, 25, -41, -31, 33, -37, 21, -15, -12, -8, 69, 57, -7, -59, 50, 45, 40, 30, -24, -31, -43, -43, 25, 16, 6, 10, -42]
Output
[116, 32, -2, 88, -88, -110, 26, 46, -50, 82, 134, 114, 82, -2, 6, -66, 72, 28, -40, 62, -92, -72, 50, -82, -62, 66, -74, 42, -30, -24, -16, 138, 114, -14, -118, 100, 90, 80, 60, -48, -62, -86, -86, 50, 32, 12, 20, -84]

Why

`doubleEach` returns `[116, 32, -2, 88, -88, -110, 26, 46, -50, 82, 134, 114, 82, -2, 6, -66, 72, 28, -40, 62, -92, -72, 50, -82, -62, 66, -74, 42, -30, -24, -16, 138, 114, -14, -118, 100, 90, 80, 60, -48, -62, -86, -86, 50, 32, 12, 20, -84]` for this input.

Example 2

doubleEach()
Input
nums = [47, -28, -40, 31, -11, 69, 18, 17, -16, 47, -45, 54, 36, -28, -26, 8, 20, 42, -7, -50, 30, 6, 3, 15, 62, 5, -52, 15, -15]
Output
[94, -56, -80, 62, -22, 138, 36, 34, -32, 94, -90, 108, 72, -56, -52, 16, 40, 84, -14, -100, 60, 12, 6, 30, 124, 10, -104, 30, -30]

Why

`doubleEach` returns `[94, -56, -80, 62, -22, 138, 36, 34, -32, 94, -90, 108, 72, -56, -52, 16, 40, 84, -14, -100, 60, 12, 6, 30, 124, 10, -104, 30, -30]` for this input.
Constraints
0 <= nums.length <= 10^5
-10^4 <= nums[i] <= 10^4
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

Arrays

Implement doubleEach in the editor and return the answer — printing it is never graded.