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

What are the three p21 of memory? Sensory, echoic, and long-term Hearing, visual, and retrieving Sensory, working, and long-term Visual, sensory, and long-term
Which source is the most reliable? a report published on Wikipedia an article evaluated by other scientists a blog about plant growth an advertisement about we
The Vietnamese led independence movements against the Chinese. a. True b. False
The ability to form rich and varied mental images or concepts of people, places, things, and situations is the definition of: A. pretending. B. fantasy. C. i
what is the value of x if 120 degrees are diagonal and 6x horizontally
what do you think a black hole is
2 angles in a tringle add up to 115 degrees what is the size of the thrid angle #
round all the way 2689
0.985 rounded to the nearest tenth
What is ''shatter'' drug?