function test() {
    if (true) {
        var isDefined = true;
    }
    alert(isDefined);
}
test();