Largest Palindrome Product - Project Euler #4 This is my code for Project Euler Problem #4
The question:

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.

My code:


function problem4(){
    let product = 1;
    let largest = 1;
    for(let i = 100; i&lt;1000; i++){
        for(let j = i; j&lt;1000; j++){
            product = i*j;
            if(("" + product) == ("" + product).split("").reverse().join("")){
                largest = Math.max(largest, product);}
}
    }
    return largest;
}
console.log(problem4());



At present, it takes 311.5649999999732 ms for execution, but I think it can be better. So how can I make it more efficient and faster?
How about this small modification that could potentially make it faster if the answer is large enough.

function problem4(){
    let product = 1;
    let largest = 1;
    for(let i = 999; i&gt;=100; i--){
        for(let j = 999; j&gt;=i &amp;&amp; i*j&gt;largest; j--){
            product = i*j;
            if(("" + product) == ("" + product).split("").reverse().join("")){
                largest = Math.max(largest, product);}
}
    }
    return largest;
}
console.log(problem4());