2
Declare a function called "move", which takes two arrays
, removes the last element of the first and adds it to the second.
Example:
var umArray = [1, 2, 3];
var outroArray = [4, 5];
mover(umArray, outroArray);
umArray //deveria ser [1, 2]
outroArray //deveria ser [4, 5, 3]
I did the following:
function mover (umArray,outroArray){
var umArray= [1, 2, 3]
var outroArray=[4, 5]
var pegarElemento = umArray.pop();
outroArray.push( pegarElemento );
}
I don’t know how to proceed.
The same question was asked yesterday... https://answall.com/questions/423599/trocando-elements-nos-arrays-com-uma-functionHow-to
– vik