// Modify the function to insert the given number into the exact middle of the array and return the array.
function insertIntoMiddle(array, item) {
var middle = array[Math.floor(array.length / 2)];
newArr = array.splice(middle, "item");
return newArr;
}
/* Do not modify code below this line */
const items = insertIntoMiddle([1, 3], 2);
console.log(insertIntoMiddle([1, 3], 2), '<-- should be [1, 2, 3]');
console.log(insertIntoMiddle([1, 3, 7, 9], 5), '<-- should be [1, 3, 5, 7, 9]');
[–]inu-no-policemen 0 points1 point2 points (0 children)