### Two-Array Zipper

Algorithms
Logic
Arrays
Data Types

Join two arrays of the same length by placing one value from the first array, then one from the second, and so on.

``````const arr1 = [1, 2, 3];
const arr2 = ['a', 'b', 'c'];

zip(arr1, arr2); // returns => [1, 'a', 2, 'b', 3, 'c']
``````
``````function zip(arr1, arr2) {
const result = [];

for (let i = 0; i < arr1.length; i++) {
result.push(arr1[i], arr2[i]);
}

return result;
}``````
Failed Tests

### Proxy Decoder

Idea for Kata
You are given an endpoint server and an array of objects {server-sender, server-receiver}. The task is to find the initial server from which the request was submitted.

Example:
proxyDecoder('Vanuatu174', [{from: 'Tonga6120', to: 'SouthAfrica1124' }, { from: 'SouthAfrica1124', to: 'Paraguay8257' }, { from: 'Paraguay8257', to: 'Vanuatu174' }] -> 'Tonga6120'

I have already written several functions for creating a random array to test. It is necessary to create a function that combines endpoint and array, to randomize the sorting and to add extra queries that are not related to the task. And find bugs, of course

``````function getRandomServer () {
let count = Math.floor(Math.random()*countries.length-1);
let random2 = Math.floor(Math.random()*10000);
return `\${countries[count]}\${random2}`;
}

function getServersArray (num) {
let array = [];
for (let i=0; i<num; i++){
array.push(getRandomServer());
}
return array;
}

function getProxyArray () {
let random = Math.floor(Math.random()*20);
if (random<2) getProxyArray ();
let serversArray = getServersArray(random);
let array = [];
for (let i=0; i<random-1; i++){
array.push({from: serversArray[i], to: serversArray[i+1]});
}
let endpoint = serversArray[serversArray.length-1];
let finalArray = array.sort(()=>Math.random()*100); //need to change this sorting, it's bad
console.log(endpoint, finalArray) //instead this function should return the example
return finalArray;
}

getProxyArray ()``````