fix htis code and what is not ocrect 

function add(x, y) {
    return x + y;
}

function subtract(x, y) {
    return x - y;
}

function multiply(x, y) {
    return x * y;
}

function divide(x, y) {
    if (y !== 0) {
        return x / y;
    } else {
        throw new Error("Cannot divide by zero!");
    }
}
console.log("Calculator Menu:");
console.log("1. Add");
console.log("2. Subtract");
console.log("3. Multiply");
console.log("4. Divide");
let choice = prompt("Enter your choice (1-4): ");
let num1 = parseFloat(prompt("Enter the first number: "));
let num2 = parseFloat(prompt("Enter the second number: "));
if (choice === '1') {
    let result = add(num1, num2);
    let operator = '+';
} else if (choice === '2') {
    let result = subtract(num1, num2);
    let operator = '-';
} else if (choice === '3') {
    let result = multiply(num1, num2);
    let operator = '*';
} else if (choice === '4') {
    try {
        let result = divide(num1, num2);
        let operator = '/';
    } catch (error) {
        console.log("Error:", error.message);
        exit();
    }
} else {
    console.log("Invalid choice!");
    exit();
}
console.log(`{num1} {operator} {num2} = {result}`); Write your response with exactly 7 paragraphs, separated with the markdown divider: ***.
user