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
JavaScript version
const truncate = (n) => ~~n;
TypeScript version
const truncate = (n: number): number => ~~n;
Examples
truncate(25.198726354); // 25
truncate(-25.198726354); // -25