// Before
const array = [0, 1,2,3,4,5,6,7,8,9];
const afirstElement = array[0];
const afourthElement = array[3]
const alastElement = array[array.length - 1];
const athirdLastElement = array[array.length - 3];
// After
const arrayNew = [0, 1,2,3,4,5,6,7,8,9];
const bfirstElement = arrayNew.at(0);
const bfourthElement = arrayNew.at(3)
const blastElement = arrayNew.at(-1);
const bthirdLastElement = arrayNew.at(-3);
console.log({
before: {
afirstElement, afourthElement, alastElement, athirdLastElement
},
after: {
bfirstElement, bfourthElement, blastElement, bthirdLastElement
}
})