Domanda di colloquio di Perfios Software

3 question programming the interviewer asked three problem questions 1. sort two array function concatArray(arr) { let result = []; let output = []; result = arr.slice(arr.length/2); let firstArr = arr.slice(0,arr.length - result.length); for(let i=0; i< firstArr.length; i++ ) { output.push(firstArr[i]); output.push(result[i]); } return output } 2. Question is sort array var a = [1,3,5], b = [6,3,4,7,8] var concatArr = [...a ,...b]; function sortArray(concatArr) { for(let i=0;i concatArr[j+i]){ var temp = concatArr[j]; concatArr[j] = concatArr[j+i]; concatArr[j+i] = temp; } } } return concatArr }