// 1. push()
let arrPush = [1, 2, 3];
arrPush.push(4, 5);
console.log(arrPush); // Output: [1, 2, 3, 4, 5]
// 2. pop()
let arrPop = [1, 2, 3, 4, 5];
let popped = arrPop.pop();
console.log(popped); // Output: 5
console.log(arrPop); // Output: [1, 2, 3, 4]
// 3. shift()
let arrShift = [1, 2, 3, 4, 5];
let shifted = arrShift.shift();
console.log(shifted); // Output: 1
console.log(arrShift); // Output: [2, 3, 4, 5]
// 4. unshift()
let arrUnshift = [1, 2, 3];
arrUnshift.unshift(-3, -2, -1, 0);
console.log(arrUnshift); // Output: [-3, -2, -1, 0, 1, 2, 3]
// 5. splice()
let arrSplice = [1, 2, 3, 4, 5];
arrSplice.splice(2, 1, 'a', 'b');
console.log(arrSplice); // Output: [1, 2, 'a', 'b', 4, 5]
// 6. slice()
let arrSlice = [1, 2, 3, 4, 5];
let sliced = arrSlice.slice(1, 4);
console.log(sliced); // Output: [2, 3, 4]
// 7. concat()
let arrConcat1 = [1, 2, 3];
let arrConcat2 = [4, 5];
let concatenated = arrConcat1.concat(arrConcat2);
console.log(concatenated); // Output: [1, 2, 3, 4, 5]
// 8. indexOf()
let arrIndexOf = [1, 2, 3, 4, 5, 4];
let index = arrIndexOf.indexOf(4);
console.log(index); // Output: 3
// 9. lastIndexOf()
let arrLastIndexOf = [1, 2, 3, 4, 5, 4];
let lastIndex = arrLastIndexOf.lastIndexOf(4);
console.log(lastIndex); // Output: 5
// 10. includes()
let arrIncludes = [1, 2, 3, 4, 5];
let included = arrIncludes.includes(3);
console.log(included); // Output: true
// 11. forEach()
let arrForEach = [1, 2, 3, 4, 5];
arrForEach.forEach(element => {
console.log(element);
});
// Output: 1, 2, 3, 4, 5 (each element on a new line)