$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Javascript Closures
Search
bjelli
July 18, 2012
Programming
3
890
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
570
Berufe im World Wide Web
bjelli
0
250
Teach (all the) Rails
bjelli
0
440
Ruby One-Liners
bjelli
1
340
Other Decks in Programming
See All in Programming
【CA.ai #3】Google ADKを活用したAI Agent開発と運用知見
harappa80
0
310
AIコーディングエージェント(Manus)
kondai24
0
180
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
110
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
330
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
110
30分でDoctrineの仕組みと使い方を完全にマスターする / phpconkagawa 2025 Doctrine
ttskch
4
860
Integrating WordPress and Symfony
alexandresalome
0
150
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
160
【CA.ai #3】ワークフローから見直すAIエージェント — 必要な場面と“選ばない”判断
satoaoaka
0
240
Github Copilotのチャット履歴ビューワーを作りました~WPF、dotnet10もあるよ~ #clrh111
katsuyuzu
0
110
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
11
11k
TestingOsaka6_Ozono
o3
0
150
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
The Cult of Friendly URLs
andyhume
79
6.7k
Bash Introduction
62gerente
615
210k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
730
How to Ace a Technical Interview
jacobian
280
24k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.7k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.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