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
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
1k
Intro to HTML5
leanmachine
3
990
Organizing Stylesheets with CSS Pre-processors
leanmachine
2
970
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
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
180
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.4k
yield再入門 #phpcon
o0h
PRO
0
980
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
550
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
380
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.9k
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
720
今さら聞けない .NET CLI
htkym
0
180
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
160
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
18k
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
110
React本体のコードリーディング
high_g_engineer
1
140
Featured
See All Featured
Un-Boring Meetings
codingconduct
0
380
A Soul's Torment
seathinner
6
3.4k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
670
Making the Leap to Tech Lead
cromwellryan
135
10k
Abbi's Birthday
coloredviolet
3
9.3k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
330
Context Engineering - Making Every Token Count
addyosmani
9
1k
Rails Girls Zürich Keynote
gr2m
96
14k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
400
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