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
1.1k
JavaScript Closures
Lean Machine
September 04, 2013
Tweet
Share
More Decks by Lean Machine
See All by Lean Machine
Graceful Degradation with Modernizr
leanmachine
1
1k
Intro to HTML5
leanmachine
3
980
Organizing Stylesheets with CSS Pre-processors
leanmachine
2
950
Responsive Web Design in a Nutshell
leanmachine
3
130
Seven UX Design Rules
leanmachine
9
1k
JavaScript Inheritance
leanmachine
2
1.1k
Asynchronous JavaScript
leanmachine
1
950
JavaScript Promises
leanmachine
2
1.1k
Other Decks in Programming
See All in Programming
ASP.NET Core の OpenAPIサポート
h455h1
0
160
Package Traits
ikesyo
2
230
Amazon Bedrock Multi Agentsを試してきた
tm2
1
240
令和7年版 あなたが使ってよいフロントエンド機能とは
mugi_uno
12
6.1k
DevinとCursorから学ぶAIエージェントメモリーの設計とMoatの考え方
itarutomy
1
500
EC2からECSへ 念願のコンテナ移行と巨大レガシーPHPアプリケーションの再構築
sumiyae
3
630
自動で //nolint を挿入する取り組み / Gopher's Gathering
utgwkk
1
170
HTML/CSS超絶浅い説明
yuki0329
0
210
盆栽転じて家具となる / Bonsai and Furnitures
aereal
0
2.2k
『改訂新版 良いコード/悪いコードで学ぶ設計入門』活用方法−爆速でスキルアップする!効果的な学習アプローチ / effective-learning-of-good-code
minodriven
29
4.8k
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
140
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
360
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Gamification - CAS2011
davidbonilla
80
5.1k
Designing for humans not robots
tammielis
250
25k
Navigating Team Friction
lara
183
15k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Typedesign – Prime Four
hannesfritz
40
2.5k
BBQ
matthewcrist
85
9.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
KATA
mclloyd
29
14k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
30
2.1k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
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