Search
 
SCRIPT & CODE EXAMPLE
 

C

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));
Comment

PREVIOUS NEXT
Code Example
C :: char ASCII in c 
C :: include ‘<stdlib.h’ or provide a declaration of ‘exit’ 
C :: pandoc set margins pdf 
C :: Initialization of a 3d array in c 
C :: . Simulate MVT and MFT. 
C :: choose random number with weight 
C :: pointer arithmetic on Arrray in c 
C :: c assignment operators 
C :: getline() in c 
C :: Write a C program to multiply two integers using pointers. 
C :: Relational Operator in C language 
C :: print the name of a file c 
C :: relational operators in c 
C :: logical operators in c 
C :: c functions 
C :: c read file from command line 
C :: 2 html 1 javascript 
C :: do a barrel roll 
C :: como somar em C 
C :: fork 
C :: convert calendar time to epoch in c programming 
C :: error: invalid type for iteration variable ‘i’ #pragma omp parallel for 
C :: input multipal data types 
C :: Macro definition and expansion 
C :: send array through a pipe 
C :: C linked sorted lists 
C :: c bind str and int 
C :: read a string 
C :: C How to use enums for flags? 
C :: C++ initalize int16_t value 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =