Hacker News new | ask | show | jobs
by twfarland 3275 days ago
This looks a bit overdone. For the first example I'd just do it like this:

    const numbers = [,'one','two','three']
    function matchNumber(n: number) { return numbers[n] || n }