🧭 Objective

Create a simple ATM Simulation program using JavaScript (no UI, only prompt() and alert() dialogs).

🧩 Requirements

  1. Start with a Default Balance

    let balance = 1000;
    

    This represents the user’s account balance.

  2. Ask for a PIN

  3. Show the Main Menu

    Once the correct PIN is entered, display a menu using a prompt():

    let choice = prompt(
      "Welcome to JS ATM πŸ’³\n\n" +
      "1️⃣ Check Balance\n" +
      "2️⃣ Withdraw\n" +
      "3️⃣ Deposit\n" +
      "4️⃣ Exit\n\n" +
      "Enter your choice (1-4):"
    );
    
  4. Handle Each Option

    Option 1 – Check Balance

    β†’ Show the current balance using alert("Your balance is: $" + balance);

    Option 2 – Withdraw

    β†’ Ask how much to withdraw (prompt()),

    β†’ If the amount is more than the balance, show alert("Insufficient funds!")

    β†’ Otherwise, subtract it from balance and show alert("Withdrawal successful! New balance: $" + balance);

    Option 3 – Deposit

    β†’ Ask how much to deposit (prompt()),

    β†’ Add it to balance,

    β†’ Show alert("Deposit successful! New balance: $" + balance);

    Option 4 – Exit

    β†’ Show alert("Thank you for using the ATM!") and end the program.

  5. Invalid Input

    β†’ If the user enters anything other than 1–4, show alert("Invalid option!").

βœ… Example Flow

Enter PIN: 1234
β†’ Welcome to the ATM!
   1. Check Balance
   2. Withdraw
   3. Deposit
   4. Exit

User chooses 2 β†’ Withdraw
Enter amount: 200
β†’ Withdrawal successful! New balance: $800