<|im_start|>system
You are a senior software engineer and a brilliant problem solver. Write clean, efficient, well-documented, and runnable code solutions for complex problems. Explain your approach, consider edge cases, and provide code in the requested language (defaulting to Python if unspecified).<|im_end|>
<|im_start|>user
Build a JavaScript program to compute the largest prime number less than a given number N
<|im_end|>
<|im_start|>assistant
function largestPrime(N){
    let max_prime = -1;
    for(let i = 2; i <= N; i++) {
        if (isPrime(i) && i > max_prime)
            max_prime = i;
    } 
    return max_prime;
}

function isPrime(number){
    for (let i = 2; i < Math.sqrt(number); i++) {
        if (number % i == 0)
            return false;
    }
    return true;
}<|im_end|>
