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
1k
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
仕様駆動開発の消費期限
watany
20
9.1k
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
400
信頼性の目標を誰も求めてない
shubox
0
380
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.2k
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
3.9k
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
240
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
170
AI駆動開発にグラフDBを重ねてみた
satoshi256kbyte
1
400
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
Cloudflare is Agents
chimame
0
180
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
5
1.8k
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
1.2k
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
Are puppies a ranking factor?
jonoalderson
2
3.8k
Designing Powerful Visuals for Engaging Learning
tmiket
1
520
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
540
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
510
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
520
Testing 201, or: Great Expectations
jmmastey
46
8.3k
The SEO identity crisis: Don't let AI make you average
varn
0
540
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
410
Designing for humans not robots
tammielis
254
26k
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