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
AtCoder Conference 2025
shindannin
0
1k
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
990
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
1.1k
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
CSC307 Lecture 09
javiergs
PRO
1
830
CSC307 Lecture 05
javiergs
PRO
0
500
Package Management Learnings from Homebrew
mikemcquaid
0
210
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
190
MUSUBIXとは
nahisaho
0
130
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
510
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Designing for Performance
lara
610
70k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
200
How to make the Groovebox
asonas
2
1.9k
The Curse of the Amulet
leimatthew05
1
8.3k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
440
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
64
The browser strikes back
jonoalderson
0
360
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
51
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
A Soul's Torment
seathinner
5
2.2k
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