decla-red/frontend/src/scripts/helper/last.ts
2020-07-20 21:58:31 +02:00

3 lines
99 B
TypeScript

export function last<T>(a: Array<T>): T | null {
return a.length > 0 ? a[a.length - 1] : null;
}