I was epected this function to return false because the arrays are not identical. What am I doing wrong?

function isUniform(arr) {
  let i;
  let j;
  for (i = 0, j = arr.length - 1; i < arr.length, j >= 0; i++, j--) {
    console.log(arr[i], arr[j]);
  if (arr[i] !== arr[j]) {
    return false;
  return true;

const result = isUniform([1, 2, 1, 1]);

I’m not sure I understand exactly what you are trying to do here. Can you explain in more detail? Your for loop isn’t doing anything other than printing to the console. I’m assuming it should be doing something else but I’m not sure what that is. You referred to ‘arrays are not identical’ but I’m only seeing one array.

You are comparing the contents of arr[0] and arr[arr.length - 1], which are the same in your example.