Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
JavaScript Closures
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Lean Machine
September 04, 2013
Programming
1.1k
1
Share
JavaScript Closures
Lean Machine
September 04, 2013
More Decks by Lean Machine
See All by Lean Machine
Graceful Degradation with Modernizr
leanmachine
1
1k
Intro to HTML5
leanmachine
3
990
Organizing Stylesheets with CSS Pre-processors
leanmachine
2
960
Responsive Web Design in a Nutshell
leanmachine
3
140
Seven UX Design Rules
leanmachine
9
1k
JavaScript Inheritance
leanmachine
2
1.1k
Asynchronous JavaScript
leanmachine
1
970
JavaScript Promises
leanmachine
2
1.1k
Other Decks in Programming
See All in Programming
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
990
Feature Toggle は捨てやすく使おう
gennei
0
510
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
370
CDK Deployのための ”反響定位”
watany
3
620
LM Linkで(非力な!)ノートPCでローカルLLM
seosoft
0
440
CursorとClaudeCodeとCodexとOpenCodeを実際に比較してみた
terisuke
1
320
PHPで TLSのプロトコルを実装してみるをもう一度しゃべりたい
higaki_program
0
190
Rethinking API Platform Filters
vinceamstoutz
0
11k
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
170
感情を設計する
ichimichi
5
1.3k
Go_College_最終発表資料__外部公開用_.pdf
xe_pc23
0
150
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
170
Featured
See All Featured
Navigating Weather and Climate Data
rabernat
0
160
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.8k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
54k
GitHub's CSS Performance
jonrohan
1032
470k
The Language of Interfaces
destraynor
162
26k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Odyssey Design
rkendrick25
PRO
2
570
Typedesign – Prime Four
hannesfritz
42
3k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
510
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.1k
Rails Girls Zürich Keynote
gr2m
96
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