export function getClosest(array: number[], num: number) { return array.sort((a, b) => { return Math.abs(a - num) - Math.abs(b - num); })[0]; }