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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
590
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
990
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
180
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
250
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
200
2026年 エンジニアリング自己学習法
yumechi
0
130
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
150
CSC307 Lecture 04
javiergs
PRO
0
660
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
980
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
180
Featured
See All Featured
Believing is Seeing
oripsolob
1
53
Why Our Code Smells
bkeepers
PRO
340
58k
Statistics for Hackers
jakevdp
799
230k
Between Models and Reality
mayunak
1
180
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
320
Darren the Foodie - Storyboard
khoart
PRO
2
2.3k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
310
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
130
4 Signs Your Business is Dying
shpigford
187
22k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
910
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
Designing for humans not robots
tammielis
254
26k
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