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
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
960
JavaScript Promises
leanmachine
2
1.1k
Other Decks in Programming
See All in Programming
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
0
130
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
760
GoのDB アクセスにおける 「型安全」と「柔軟性」の両立 - Bob という選択肢
tak848
0
230
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1.1k
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
4
440
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
150
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.1k
仕様漏れ実装漏れをなくすトレーサビリティAI基盤のご紹介
orgachem
PRO
6
2.3k
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
590
PHPで TLSのプロトコルを実装してみる
higaki_program
0
240
SourceGeneratorのマーカー属性問題について
htkym
0
200
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
74
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
980
SEO for Brand Visibility & Recognition
aleyda
0
4.4k
Design in an AI World
tapps
0
170
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
95
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
490
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
The SEO identity crisis: Don't let AI make you average
varn
0
420
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.9k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
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