TypeScript Array Maximal Adjacement Difference
function arrayMaximalAdjacentDifference(a: number[]): number {
  let dif = 0;
  for (let i = 1; i < a.length - 1; i++) {
    dif = Math.max(dif, Math.abs(a[i] - a[i - 1]), Math.abs(a[i] - a[i + 1]));
  }

  return dif;
}

This checks the gap between each pair of neighbors and returns the largest difference.