Web navigator exercise - stacks - linear data structure

Just completed the following exercise
https://www.codecademy.com/journeys/front-end-engineer/paths/fecj-22-interview-prep/tracks/fecj-22-linear-data-structures/modules/wdcp-22-stacks-8660c6a7-358f-4a18-bfd6-3024b0b9f584/projects/learn-stacks-javascript-web-navigator
, and it seems to work without issues: any thoughts?:

const Stack = require('./Stack');
const prompt = require('prompt-sync')();

// Initialization
const backPages = new Stack();
let nextPages = new Stack(); // Note: Initialize nextPages as a new Stack
let currentPage = 'Start Page';

// Helper Functions
function showCurrentPage(action) {
  console.log(`\n${action}`);
  console.log(`Current page = ${currentPage}`);
  console.log(`Back page = ${backPages.peek()}`);
  console.log(`Next page = ${nextPages.peek()}`);
}

function newPage(page) {
  backPages.push(currentPage);
  currentPage = page;
  nextPages = new Stack(); // Clear nextPages using the updated Stack class
  showCurrentPage('New Page');
}

function backPage() {
  nextPages.push(currentPage);
  currentPage = backPages.pop();
  showCurrentPage('Back Page');
}

function nextPage() {
  backPages.push(currentPage);
  currentPage = nextPages.pop();
  showCurrentPage('Next Page');
}

// User Interface Part 1
let finish = false;
let showBack = false;
let showNext = false;

showCurrentPage('DEFAULT');

// User Interface Part 2
while (!finish) {
  let instructions = '\nEnter a url';

  if (!backPages.isEmpty()) {
    instructions += ', B|b for back page';
    showBack = true;
  } else {
    showBack = false;
  }

  if (!nextPages.isEmpty()) {
    instructions += ', N|n for next page';
    showNext = true;
  } else {
    showNext = false;
  }

  instructions += ', Q|q for quit';
  console.log(instructions);

  const answer = prompt('Where would you like to go today? ');
  const lowerCaseAnswer = answer.toLowerCase();

  if (lowerCaseAnswer === 'q') {
    finish = true;
  } else if (lowerCaseAnswer === 'b' && showBack) {
    backPage();
  } else if (lowerCaseAnswer === 'n' && showNext) {
    nextPage();
  } else if (/^(http|https):\/\//.test(lowerCaseAnswer)) {
    newPage(lowerCaseAnswer);
  } else {
    console.log('Invalid input. Please try again.');
  }
}