Double Each Value (Set 2)

Easy

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

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

Example 1

doubleEach()
Input
nums = [-51, -8, -52, 23, 34, 43, 70]
Output
[-102, -16, -104, 46, 68, 86, 140]

Why

`doubleEach` returns `[-102, -16, -104, 46, 68, 86, 140]` for this input.

Example 2

doubleEach()
Input
nums = [67, 7, -57, -50, 61, 57, 22, -9, -7, 1, -55, -38, 14, 32, -57]
Output
[134, 14, -114, -100, 122, 114, 44, -18, -14, 2, -110, -76, 28, 64, -114]

Why

`doubleEach` returns `[134, 14, -114, -100, 122, 114, 44, -18, -14, 2, -110, -76, 28, 64, -114]` 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.