const input_number = document.querySelector("#input-number");
const output = document.querySelector("#output");
const btn_submit = document.querySelector("#btn-submit");

function is_prime_number(number)
{
    if (number <= 1)
    {
        return false;
    }

    // Brutforce method
    for (i = 2; i < number; i++)
    {
        if (number % i == 0)
        {
            return false;
        }
    }

    return true;
}

btn_submit.addEventListener("click", (event) => {
    const number = input_number.value;

    if (is_prime_number(number))
    {
        output.textContent = "Result: number is prime";
    }
    else
    {
        output.textContent = "Result: number is NOT prime";
    }
});
