Write a function 'transformFirstAndLast' that takes in an array, and returns an object with:
function transformFirstAndLast(array) {
let a = {};
array.length > 0 ? (a[array.shift()] = array.pop()) : null;
return a;
}
console.log(
transformFirstAndLast(["Queen", "Elizabeth", "Of Hearts", "Beyonce"])
);