Typescript Array Shift Undefined Slope Calculator