×
データ構造とアルゴリズム
// スタックの動作イメージ
let historyStack = [];
historyStack.push("ページA");
historyStack.push("ページB"); // ページBが一番上にある
let lastPage = historyStack.pop(); 
console.log(lastPage); // 出力: "ページB" (最後に入れたものが最初に出る)

もう少し詳しく