Created
November 10, 2019 17:31
-
-
Save ramazankanbur/d255dab407f05c90d4fa1047319b8ed2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //var function scoped | |
| //let block scoped | |
| function test1() { | |
| if (true) { | |
| var dummy1 = 'var belirtecinden'; | |
| let dummy2 = 'let belirtecinden'; | |
| console.log(dummy1); | |
| //output => var belirtecinden | |
| console.log(dummy2); | |
| //output => let belirtecinden | |
| var dummy1 = 'var yeniden tanımlama'; | |
| let dummy2 = 'let yeniden tanımlama'; | |
| //output => SyntaxError: Identifier 'dummy2' has already been declared | |
| } | |
| console.log(dummy1); | |
| //output => var belirtecinden | |
| console.log(dummy2); | |
| //output => ReferenceError: dummy2 is not defined | |
| } | |
| test1(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment