as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
create a function in javascript to check if a given number is prime
user
function checkprime(num) {
    //handle negative numbers
    if (num <= 1) return false;

    //check if it is divisible by any number other than itself and 1
    for (let i = 2; i < num; i++) {
        if (num % i === 0) {
            return false;
        }
    }
    return true;
}
assistant