makayladroste9079 makayladroste9079
  • 12-11-2020
  • Computers and Technology
contestada

Write the function appendEvens() which, given two arrays, adds all of the even elements from the first to the second. You may assume the second has enough space.

Respuesta :

IfeanyiEze8899 IfeanyiEze8899
  • 14-11-2020

Answer:

function appendEvens( arr1, arr2) {

   for (let i in arr1){

       if (i%2 == 0){

           arr2.push(i);

       }

   }

}

Explanation:

The defined javascript function "appendEvens" is a function that returns undefined. It accepts two arrays and pushes the even numbers from the first array to the second.

Answer Link

Otras preguntas

could someone do a step-by-step? 2x < x − 4 ≤ 3x + 8
In Athens, laws were voted on and passed by which of the following?
Can someone please help me? :( A. Basma is an independent kingdom. B. the people of Basma have their own language. C. Basma is located near the kingdom of Ferle
So I need to vent to my friend but I'm kinda scared to tell him, what do I do.
Which shows an isomer of the molecule below?
Find the total value of an investment of $1,030 at 4% compounded semi-annually for 2 years to the nearest dollar
If a car passes mile-marker 30 in 4 hours and mile-marker 120 in 5 hours, how many miles per hour is the car traveling?
Help! Will mark brainliest!
Which of the following can be a common denominator for the fractions 2/5 and 3/4? 4 10 5 20
Authors show evidence to support their claim. FALSE TRUE