Hacker News new | past | comments | ask | show | jobs | submit login

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 }



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: