JavaScript配列pop
map

pop配列

push

最後の要素を削除して返します。

構文

arr.pop()

使用例

下記の値を入力するとサンプルに即時反映されます。

const
stack
pop
console
const stack = [1, 2, 3];
const last = stack.pop();
console.log(last);    // 3
console.log(stack);   // [1, 2]