Update 01_javascript_refresher.md

fix scope example
pull/359/head
JanWarlen 2 years ago committed by GitHub
parent 8b41cd49c3
commit 062151eaed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1670,12 +1670,12 @@ function letsLearnScope() {
let a = 'Python' let a = 'Python'
let b = 20 let b = 20
let d = 40 let d = 40
console.log(a, b, c) // Python 20 30 console.log(a, b, c, d) // Python 20 30 40
} }
// we can not access c because c's scope is only the if block console.log(a, b, c) // JavaScript 10 30
console.log(a, b) // JavaScript 10
} }
letsLearnScope() letsLearnScope()
// we can not access c because c's scope is only the function 'letsLearnScope' block
console.log(a, b) // JavaScript 10, accessible console.log(a, b) // JavaScript 10, accessible
``` ```

Loading…
Cancel
Save