Array Processing Function Analysis
Consider the following code segment:
function processData(data)
{
let result = [];
for (let i = 0; i < data.length; i++)
{
if (data[i] > 0)
{
result.push(data[i] * 2);
}
}
return result;
}
What is the function of this code segment?
A
Removes negative values from the original array
B
Doubles all values in the original array
C
Counts the number of positive values in the array
D
Creates a new array with positive values doubled
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | soniahalepota2005 | 1 | 1 | 0m 10s | 90 |
| #2 | tianbo.shen | 1 | 1 | 0m 20s | 80 |
| #3 | my.emma.mei | 1 | 1 | 0m 47s | 53 |
| #4 | devanshs905 | 1 | 2 | 0m 43s | 47 |
| #5 | proundpimfhao | 0 | 1 | 0m 00s | -10 |
| #6 | Sushantpr.2506 | 0 | 1 | 0m 07s | -17 |
| #7 | spiritgen02 | 0 | 1 | 0m 15s | -25 |
| #8 | batonoltanr | 0 | 1 | 0m 55s | -65 |
Items per page:
10
1 – 8 of 8
APFIVE