- Notifications
You must be signed in to change notification settings - Fork44
Variable scope, closure#204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
ImVietnam wants to merge85 commits intojavascript-tutorial:masterChoose a base branch fromImVietnam:patch-26
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Open
Changes fromall commits
Commits
Show all changes
85 commits Select commitHold shift + click to select a range
68a7885 Update article.md
ImVietnam6df7986 Update article.md
ImVietnam6612812 Update article.md
ImVietnamef2e635 Update article.md
ImVietname43b1f7 Update article.md
ImVietnam4ea135d Update closure-function-declaration.svg
ImVietnam9bfddd4 Update closure-function-declaration.svg
ImVietnamf7be4f0 Update article.md
ImVietname1eaab5 Update closure-makecounter-environment.svg
ImVietnamb20946b Update closure-makecounter-environment.svg
ImVietnamc84df45 Update closure-makecounter-nested-call-2.svg
ImVietnamdcafb7b Update closure-makecounter-nested-call-2.svg
ImVietnamb33c5eb Update closure-function-declaration.svg
ImVietnamb6a548f Update closure-makecounter-environment.svg
ImVietnam8a4eede Update closure-makecounter-nested-call.svg
ImVietnamb63ae2c Update closure-makecounter-nested-call.svg
ImVietnam57be90e Update closure-makecounter-nested-call.svg
ImVietnam714290e Update closure-makecounter-nested-call.svg
ImVietnam929d822 Update closure-makecounter-nested-call.svg
ImVietnam00f9f89 Update closure-makecounter-nested-call.svg
ImVietname2345d6 Update closure-makecounter-environment.svg
ImVietnama7651b3 Update closure-makecounter-nested-call-2.svg
ImVietnam942b855 Update closure-makecounter-nested-call-2.svg
ImVietnam091c5b4 Update article.md
ImVietnamae48d63 Update closure-function-declaration.svg
ImVietnam937e670 Update closure-function-declaration.svg
ImVietnam3a56f9c Update closure-makecounter-environment.svg
ImVietnam86d3653 Update closure-makecounter-nested-call-2.svg
ImVietnam1b3695f Update closure-makecounter-nested-call.svg
ImVietnam4f7b3a6 Update closure-makecounter.svg
ImVietnamc7f8584 Update closure-variable-phrase.svg
ImVietnam2cb5bff Update lexenv-if.svg
ImVietnam9ec38bb Update lexenv-if.svg
ImVietnam3c11ee1 Update lexenv-nested-makecounter-1.svg
ImVietnam78ce0b6 Update lexenv-nested-makecounter-2.svg
ImVietnam0324e13 Update lexenv-nested-makecounter-3.svg
ImVietnamf06eecc Update lexenv-nested-makecounter-4.svg
ImVietnama434eda Update lexenv-nested-makecounter-5.svg
ImVietnam8046ccf Update closure-makecounter-environment.svg
ImVietnama0c22c3 Update article.md
ImVietnam35ebe02 Update closure-function-declaration.svg
ImVietnamf163cc1 Update closure-function-declaration.svg
ImVietnam2de5a79 Update lexenv-nested-makecounter-6.svg
ImVietnam2dc9df3 Update lexenv-nested-makecounter-6.svg
ImVietnamda07960 Update lexical-environment-global-2.svg
ImVietnam933bdf2 Update lexical-environment-global-3.svg
ImVietnam4680376 Update lexical-environment-global.svg
ImVietnam08fb0e6 Update lexical-environment-simple-lookup.svg
ImVietnamc52ca7a Update lexical-environment-simple.svg
ImVietnam0ccb59e Update task.md
ImVietname08d150 Update solution.md
ImVietnam586002a Update task.md
ImVietnam4b1c1a4 Update solution.md
ImVietnama53cfc9 Update lexenv-makearmy-while-fixed.svg
ImVietnam2f0ef5f Update lexenv-makearmy-for-fixed.svg
ImVietnamd1388ba Update lexenv-makearmy-empty.svg
ImVietnam4712bdb Update solution.js
ImVietnambe8977f Update source.js
ImVietnamab8799e Update task.md
ImVietnamde8624e Update task.md
ImVietnam9d06bfa Update solution.md
ImVietnam251255c Update lexenv-nested-work.svg
ImVietnam1efc4b9 Update task.md
ImVietnam5b1b1ee Update solution.md
ImVietnam9bd3d03 Update task.md
ImVietnam93fcf08 Update solution.md
ImVietnam9462ff1 Update task.md
ImVietnamdaffeaf Update solution.md
ImVietnam9939895 Update task.md
ImVietnamf5eec0e Update task.md
ImVietnambe7da66 Update solution.md
ImVietnam2a43201 Update task.md
ImVietnam492335b Update solution.md
ImVietnam09d2e63 Update task.md
ImVietnamdb7d52c Update task.md
ImVietnam9e754ad Update solution.md
ImVietname575ae5 Update source.js
ImVietnam0a5c3fc Update task.md
ImVietnam08ef596 Update source.js
ImVietnamc50d02b Update solution.md
ImVietnam56deede Update solution.md
ImVietnam8502b4d Update solution.md
ImVietnam3af0ffb Update solution.md
ImVietnam3718a0b Merge branch 'javascript-tutorial:master' into patch-26
ImVietnamfb9352a Merge branch 'javascript-tutorial:master' into patch-26
ImVietnamFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
6 changes: 3 additions & 3 deletions1-js/06-advanced-functions/03-closure/1-closure-latest-changes/solution.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| Đáp án là: **Pete**. | ||
| Một hàm nhận các biến bên ngoài như hiện tại, nó sử dụng các giá trị gần đây nhất. | ||
| Giá trị biến cũ không được lưu ở bất cứ đâu. Khi một hàm muốn một biến, nó sẽ lấy giá trị hiện tại từ Lexical Environmentcủa chính nó hoặc environment bên ngoài. |
10 changes: 5 additions & 5 deletions1-js/06-advanced-functions/03-closure/1-closure-latest-changes/task.md
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
4 changes: 2 additions & 2 deletions1-js/06-advanced-functions/03-closure/10-make-army/_js.view/solution.js
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
10 changes: 5 additions & 5 deletions1-js/06-advanced-functions/03-closure/10-make-army/_js.view/source.js
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
2 changes: 1 addition & 1 deletion1-js/06-advanced-functions/03-closure/10-make-army/lexenv-makearmy-empty.svg
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion1-js/06-advanced-functions/03-closure/10-make-army/lexenv-makearmy-for-fixed.svg
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion1-js/06-advanced-functions/03-closure/10-make-army/lexenv-makearmy-while-fixed.svg
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 27 additions & 27 deletions1-js/06-advanced-functions/03-closure/10-make-army/solution.md
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
26 changes: 13 additions & 13 deletions1-js/06-advanced-functions/03-closure/10-make-army/task.md
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
2 changes: 1 addition & 1 deletion...-advanced-functions/03-closure/2-closure-variable-access/lexenv-nested-work.svg
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions1-js/06-advanced-functions/03-closure/2-closure-variable-access/solution.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| Đáp án là: **Pete**. | ||
| Hàm `work()`trong đoạn mã bên dưới lấy `name`từ nơi xuất phát của nó thông qua tham chiếulexical environmentbên ngoài: | ||
|  | ||
| Vì vậy, kết quả là `"Pete"`ở đây. | ||
| Nhưng nếu không có`let name`trong `makeWorker()`,thì tìm kiếm sẽ ra bên ngoài và lấy biến cục bộ như chúng ta có thể thấy từ chuỗi bên trên. Trong trường hợp đó, kết quả sẽ là `"John"`. |
14 changes: 7 additions & 7 deletions1-js/06-advanced-functions/03-closure/2-closure-variable-access/task.md
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
6 changes: 3 additions & 3 deletions1-js/06-advanced-functions/03-closure/3-counter-independent/solution.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| Đáp án: **0,1.** | ||
| Các hàm`counter`và `counter2`được tạo bởi các lệnh gọi khác nhau của `makeCounter`. | ||
| Vì vậy, chúng có các LexicalEnvironment bên ngoài độc lập, mỗi environment có`count` riêng. |
6 changes: 3 additions & 3 deletions1-js/06-advanced-functions/03-closure/3-counter-independent/task.md
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
4 changes: 2 additions & 2 deletions1-js/06-advanced-functions/03-closure/4-counter-object-independent/solution.md
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
6 changes: 3 additions & 3 deletions1-js/06-advanced-functions/03-closure/4-counter-object-independent/task.md
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
4 changes: 2 additions & 2 deletions1-js/06-advanced-functions/03-closure/5-function-in-if/solution.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| Kết quả là **một lỗi**. | ||
| Hàm`sayHi`được khai báo bên trong`if`,vì vậy nó chỉ tồn tại bên trong nó. Không có`sayHi`bên ngoài. |
4 changes: 2 additions & 2 deletions1-js/06-advanced-functions/03-closure/5-function-in-if/task.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| #Hàm trong if | ||
| Nhìn vào mã. Cái gì sẽ là kết quả của cuộc gọi ở dòng cuối cùng? | ||
| ```js run | ||
| let phrase = "Hello"; | ||
6 changes: 3 additions & 3 deletions1-js/06-advanced-functions/03-closure/6-closure-sum/solution.md
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
8 changes: 4 additions & 4 deletions1-js/06-advanced-functions/03-closure/6-closure-sum/task.md
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
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.