Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
JavaScript Closures
Search
Lean Machine
September 04, 2013
Programming
1.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JavaScript Closures
Lean Machine
September 04, 2013
More Decks by Lean Machine
See All by Lean Machine
Graceful Degradation with Modernizr
leanmachine
1
1.1k
Intro to HTML5
leanmachine
3
1k
Organizing Stylesheets with CSS Pre-processors
leanmachine
2
970
Responsive Web Design in a Nutshell
leanmachine
3
150
Seven UX Design Rules
leanmachine
9
1k
JavaScript Inheritance
leanmachine
2
1.1k
Asynchronous JavaScript
leanmachine
1
980
JavaScript Promises
leanmachine
2
1.1k
Other Decks in Programming
See All in Programming
Vapor Mode でアクセシビリティは 壊れないか検証した話
fuqda
1
330
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
150
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
230
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
150
私なりのハーネスエンジニアリング ~独自の言語処理系の開発を通して~
seosoft
0
180
Spec-driven Development with AI
simas
PRO
0
2.3k
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
290
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
600
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
410
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
330
クラウドエージェントは、 何がそんなに便利なのか / what makes cloud agents so useful
rkaga
5
790
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
220
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
55
13k
Become a Pro
speakerdeck
PRO
31
6.4k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
320
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
600
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
560
Facilitating Awesome Meetings
lara
57
7.2k
Abbi's Birthday
coloredviolet
4
11k
Site-Speed That Sticks
csswizardry
13
1.6k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2.1k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Transcript
for ( var i=0; i<5; i++ ) { // Wait
i seconds then print // the number of seconds waited for each i }
for ( var i=0; i<5; i++ ) { // Wait
i seconds then print // the number of seconds waited for each i }
JavaScript Closures Get comfortable leanmachine.se ▪
[email protected]
▪ 2013-09-06
Server JavaScript allows you to refer to variables that were
defined outside of the current function Functions can refer to variables defined in outer functions, even a!er those functions have returned Closures can update the values of outer variables Three rules of closures
console.log(generateUnique()); console.log(generateUnique()); console.log(generateUnique());
What does the scope chain look like?
It can be inspected in browser dev tools
Bonus The with-keyword
leanmachine.se ▪
[email protected]
▪ 2013-09-06