Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You might already know, but until do expressions land, you can use IIFEs for ifs and switches assignments:

    const isSomething = (() => {
        switch (...) {
            case ...:
                return ...
        }
    })()
They are a bit ugly but the do wonders at avoiding `let`.


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

Search: