Comment

Comment by 0x20cowboy

I agree with the spirit of this, but I’d go one more step with the example:

export function clamp(value: number, min: number, max: number): number { return }

That is just adding an extra jump and entry on the callstack where you could just have done:

Math.min(Math.max(value, min), max);

Where you need it.

(The example used was probably just for illustration though)

parent 0x20cowboy 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton