Oh sorry, what I actually meant is block scope not function scope. If you call x outside of the if scope it will return 2 with var. I'll fix that as soon possible. Thanks David :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.