Parsing Error: Unexpected token

Parsing Error: Unexpected token

The last line, return result; is giving me a parsing error. Can someone tell me what that is please?

function merge (arr1, arr2) {
  const result = [];
  let i = 0;
  let j = 0;
  while (i < arr1.length && j < arr2.length) {
    if (arr1[i] < arr2[j]) {
      result.push(arr1[i]);
      i++;
    } else {
      result.push(arr2[j]);
      j++;
    }
  }
  while (i < arr1.length) {
    result.push(arr1[i]);
    i++;
  }
  while (j < arr2.length) {
    result.push(arr2[j]);
    j++;
  }
  return result;

Hi @redblueberry17 !

Do you have a closing } tag for your function?

1 Like

oh wow! That’s why. Thank you

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.