jsFiddle
Run again
Edit this fiddle
JavaScript
HTML
CSS
Result
function test() { if (true) { var isDefined = true; } alert(isDefined); } test();