Problem 4: Largest palindrome product bug?

Tell us what’s happening:

Hello the code worked on jsbin return 906609 for console.log(largestPalindromeProduct(3)) but somehow it cannot pass the test.
is there some problem in my code (except inefficient and crude) that keep me from passing it?

Your code so far

function isPalin(n){
let NoD = Math.floor(Math.log10(n))+1; //number of digits
let halfNoD = Math.floor(n/2);
let dig = [];
let i;
for (i=0; i<NoD; i++){
for (i=0;i<halfNoD; i++){
  if (dig[i]!==dig[NoD-1-i]) return false;
return true;


function largestPalindromeProduct(n) {
  // Good luck!
  let c = Math.pow(10,n);
  let f = Math.pow(10,n-1);
  let i, j, k;
  let arrProduct = [];
  k = 0;
  for (i=f; i<c; i++){
    for (j=f; j<=i; j++){
        arrProduct[k] = i*j;
      k = k+1;
  for (i=0; i<arrProduct.length; i++){
      if (isPalin(arrProduct[i])) return arrProduct[i];
    return true;


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:

I just copy pasted your code and passed all the tests, so it should work. Maybe it is not that efficient and times out now and then?

Thanks steven.
Well it is inefficient but still a very simple process for modern computer…