arePathsEqual = function(pathA, pathB) {
  if (pathA === pathB) {
    return true;
  }
  if (!Array.isArray(pathA) || !Array.isArray(pathB)) {
    return false;
  }
  if (pathA.length !== pathB.length) {
    return false;
  }
  for (let i = 0; i < pathA.length; ++i) {
    if (pathA[i] === pathB[i]) {
      continue;
    }
    if (
      !isValidLatLng(pathA[i]) ||
      !isValidLatLng(pathB[i])
    ) {
      return false;
    }
    if (
      pathB[i].lat !== pathA[i].lat ||
      pathB[i].lng !== pathA[i].lng
    ) {
      return false;
    }
  }
  return true;
}
Compares two path arrays of LatLng objects.