function comp(array1, array2){
  console.log('array1:', array1, 'array2:', array2)
  if (!Array.isArray(array1) || !Array.isArray(array2)) {
    return false;
  }
  
  for (let i = 0; i < array1.length; i++ ) {
//     console.log(i);
    if ( Math.pow(array1[i], 2) != array2[i + 1] ) {
      console.log('false');
      console.log(Math.pow((array1[array1.length - 2]), 2), array2[array2.length - 1]);
      Math.pow((array1[array1.length - 2]), 2) != array2[array2.length - 1]
    } else if(array1[0] != array2[0] || Math.pow((array1[array1.length - 2]), 2) != array2[array2.length - 1] ){
    console.log("1 false");
      return Math.pow(array1[0], 2) === array2[0] ? true : false ;
    return false;
  }
  }
  
  console.log('true');
  return true;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: