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
310
Railsgirls: Where did my HTML and CSS go
bjelli
0
530
Berufe im World Wide Web
bjelli
0
230
Teach (all the) Rails
bjelli
0
440
Ruby One-Liners
bjelli
1
330
Other Decks in Programming
See All in Programming
In geheimer Mission: AI Agents entwickeln
joergneumann
0
110
RuboCop: Modularity and AST Insights
koic
2
2.5k
Bedrock×MCPで社内ブログ執筆文化を育てたい!
har1101
7
1.5k
ComposeでのPicture in Picture
takathemax
0
130
Making TCPSocket.new "Happy"!
coe401_
1
3.2k
「理解」を重視したAI活用開発
fast_doctor
0
280
音声プラットフォームのアーキテクチャ変遷から学ぶ、クラウドネイティブなバッチ処理 (20250422_CNDS2025_Batch_Architecture)
thousanda
0
400
MySQL初心者が311個のカラムにNot NULL制約を追加していってALTER TABLEについて学んだ話
hatsu38
2
110
VitestのIn-Source Testingが便利
taro28
8
2.4k
API for docs
soutaro
4
1.6k
大LLM時代にこの先生きのこるには-ITエンジニア編
fumiyakume
8
3.3k
カオスに立ち向かう小規模チームの装備の選択〜フルスタックTSという装備の強み _ 弱み〜/Choosing equipment for a small team facing chaos ~ Strengths and weaknesses of full-stack TS~
bitkey
1
130
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
700
It's Worth the Effort
3n
184
28k
Faster Mobile Websites
deanohume
306
31k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
33k
Site-Speed That Sticks
csswizardry
6
530
Why Our Code Smells
bkeepers
PRO
336
57k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
120
52k
Mobile First: as difficult as doing things right
swwweet
223
9.6k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.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