const arr = [1, 2, 3];

// 配列の最後の要素を削除します。
arr.pop();
console.log(arr); // 出力:[1, 2]
arr.pop()
const arr = [1, 2, 3];

// 配列の最後の要素を削除します。
const removedItem = arr.pop();
console.log(arr); // 出力:[1, 2]
console.log(removedItem); // 出力:3

// 配列が空の場合
const emptyArray = [];
const emptyArrayRemovedItem = emptyArray.pop(); // 削除する要素がなく、配列が空である

console.log(emptyArrayRemovedItem); // 出力:undefined
const fruits = ["apple", "banana", "cherry"];
const removedFruit = fruits.pop();

console.log(removedFruit); // 出力:"cherry"
const fruits = ["apple", "banana", "cherry"];
fruits.pop();

console.log(fruits.length); // 出力:2
const fruits = ["apple", "banana", "cherry"];

// 逆順に並べ替えるための空の配列を作成
const reversedFruits = [];

// 逆順に出力するためにループを使用
while (fruits.length > 0) {
    reversedFruits.push(fruits.pop());
}

// 逆順に並べ替えられた配列を出力
console.log(reversedFruits); // 出力:["cherry", "banana", "apple"]
const fruits = ["apple", "banana", "cherry"];

// 配列を逆順に並べ替える
const reversedFruits = fruits.reverse();

// 逆順に並べ替えられた配列を出力
console.log(reversedFruits); // 出力:["cherry", "banana", "apple"]
const fruits = ["apple", "banana", "cherry"];

// 配列の最後の要素を削除
delete fruits[fruits.length - 1];

// 配列を出力
console.log(fruits); // 出力:["apple", "banana", <空>]
console.log(fruits[3]); // 出力:undefined