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

>If you prefix them with var they're function scoped, but there's no way to make them local to the curly braces of an "if" statement.

There is; it's just ugly. You just have to use an immediate function as the body of the if statement.



in the words of will smith in men in black, "please keep that kinda shi* to yourself"


I don't understand what you're trying to say, but I was describing a common and useful pattern.


i was complimenting you.. ahh nevermind




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: