GitHub 6219★

Truncate a number at decimal

JavaScript version

const truncate = (n) => ~~n;

TypeScript version

const truncate = (n: number): number => ~~n;

Examples

truncate(25.198726354); // 25
truncate(-25.198726354); // -25
Follow me on and to get more useful contents.