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

Solve for x to the nearest tenth. х 3 7 3 20 POINTS
According to the article, what are the "social costs" of cell phone usage? Support your
Please please please help It’s only 3 questions please
Someone please help me on this work it would be very helpful for me
WILL MARK YOU BRAINLIEST 30 points!!!! Type the correct answer in the box. Why is it a good idea to poke holes in the plastic bags containing vegetables? Nancy
Please Help! LIST ALL THE ANSWERS! PLEASE HURRY I NEED ANSWERS ASAP THIS IS DUE IN A FEW.
A flower appears red with pink spots. What colors is this flower reflecting?
Asher is pet sitting for five dogs. He only has 1/5 of a bag of dog food left for the day. If each dog gets the same amount, what fraction of the bag will each
Who is the current Tennessee Governor?
Why were the US actions in Vietnam ironic?