Answers for "Complete the function in the editor. It has one parameter: an array, . It must iterate through the array performing one of the following actions on each element:"

C
0

Complete the function in the editor. It has one parameter: an array, . It must iterate through the array performing one of the following actions on each element:

/*
 * Modify and return the array so that all even elements are doubled and all odd elements are tripled.
 * 
 * Parameter(s):
 * nums: An array of numbers.
 */
function modifyArray(nums) {
    return (nums || []).map(num => num * (num % 2 === 0 ? 2 : 3));
Posted by: Guest on August-08-2021

Code answers related to "Complete the function in the editor. It has one parameter: an array, . It must iterate through the array performing one of the following actions on each element:"

Code answers related to "C"

Browse Popular Code Answers by Language