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
bjelli
July 18, 2012
Programming
3
900
Javascript Closures
a short introduction (in javascript + german)
bjelli
July 18, 2012
Tweet
Share
More Decks by bjelli
See All by bjelli
Intro to Web- and Mobile-Developement
bjelli
0
320
Railsgirls: Where did my HTML and CSS go
bjelli
0
580
Berufe im World Wide Web
bjelli
0
260
Teach (all the) Rails
bjelli
0
440
Ruby One-Liners
bjelli
1
340
Other Decks in Programming
See All in Programming
文字コードの話
qnighy
44
17k
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
130
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
110
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.7k
AIコーディングの理想と現実 2026 | AI Coding: Expectations vs. Reality 2026
tomohisa
0
1.2k
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
520
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
4
410
Ruby and LLM Ecosystem 2nd
koic
1
410
Codex の「自走力」を高める
yorifuji
0
1.1k
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
200
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
380
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
140
Featured
See All Featured
We Are The Robots
honzajavorek
0
190
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
190
Building Applications with DynamoDB
mza
96
7k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
WCS-LA-2024
lcolladotor
0
480
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
Writing Fast Ruby
sferik
630
63k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
480
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
74
Designing Experiences People Love
moore
143
24k
Raft: Consensus for Rubyists
vanstee
141
7.3k
Transcript
Javascript Closures
function r1( s, x ) { var result = "";
while( x ) { result += s; x--; } return s; } http://jsfiddle.net/bjelline/54dRs/ Funktionen in JS
r2 = function ( s, x ) { var result
= ""; while( x ) { result += s; x--; } return result; } http://jsfiddle.net/bjelline/54dRs/ Funktionen in JS
etwas, das als Übergabeparameter oder Rückgabewert einer Funktion oder Prozedur
auftritt bzw. einer Variable zugewiesen werden kann. Functions as first class citizens...
function mk_function() { return function() { return "Rückgabewert"; }; }
f = mk_function(); f(); g = f; Funktionen in JS
function mk_function() { var a = 42; return function() {
return "Rückgabewert ist " + a; }; } f = mk_function(); f(); innere Funktionen + vars
function mk_sammler() { var gesammelt = ""; return function(s) {
gesammelt += s; return gesammelt; }; } f = mk_sammler(); http://jsfiddle.net/bjelline/jhqbq/ innere Funktionen + vars
Für die Funktion bleibt auch die Variable erhalten Closure