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
880
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
300
Railsgirls: Where did my HTML and CSS go
bjelli
0
510
Berufe im World Wide Web
bjelli
0
210
Teach (all the) Rails
bjelli
0
440
Ruby One-Liners
bjelli
1
330
Other Decks in Programming
See All in Programming
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
130
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
2.1k
Amazon Nova Reelの可能性
hideg
0
200
Оптимизируем производительность блока Казначейство
lamodatech
0
950
Swiftコンパイラ超入門+async関数の仕組み
shiz
0
170
Внедряем бюджетирование, или Как сделать хорошо?
lamodatech
0
940
月刊 競技プログラミングをお仕事に役立てるには
terryu16
1
1.2k
AWSのLambdaで PHPを動かす選択肢
rinchoku
2
390
php-conference-japan-2024
tasuku43
0
430
情報漏洩させないための設計
kubotak
5
1.3k
rails newと同時に型を書く
aki19035vc
5
710
ESLintプラグインを使用してCDKのセオリーを適用する
yamanashi_ren01
2
240
Featured
See All Featured
Become a Pro
speakerdeck
PRO
26
5.1k
Done Done
chrislema
182
16k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
The Language of Interfaces
destraynor
155
24k
Documentation Writing (for coders)
carmenintech
67
4.5k
Into the Great Unknown - MozCon
thekraken
34
1.6k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Code Reviewing Like a Champion
maltzj
521
39k
Adopting Sorbet at Scale
ufuk
74
9.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
19
2.3k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
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