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’s the equation of the line that includes point (4,6) and has a slope of -5
Which structure best shows that eukaryotes have functions different from prokaryotes? a.RNAB)nucleus c.ribosomes d.cell walls
Hi I need help, anyone???
What is the correct way to revise the punctuation in the sentence? We could choose one of three ice cream flavors that had strawberries, cherries, and blueberr
which organelles are found in animal cell ?
When immunity to a disease is acquired naturally through a response of ones immune system it is called:?
The length of side PQ is units. The length of side QR is about units. The perimeter of the parallelogram PQRS is about units.
Analyze the diagram below and complete the instructions that follow.
Why are ionic crystals soluble in water?
A mobile phone carrier charges an extra fee if a customer uses more than 500 minutes each month. Tom has already used 230 minutes this month. Which in E quality