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
AI巻き込み型コードレビューのススメ
nealle
0
120
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
610
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.8k
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
630
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.8k
Oxlint JS plugins
kazupon
1
740
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
180
AtCoder Conference 2025
shindannin
0
1k
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
1.1k
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
230
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
450
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Abbi's Birthday
coloredviolet
1
4.7k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
160
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
220
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
47
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
230
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
54
Done Done
chrislema
186
16k
Testing 201, or: Great Expectations
jmmastey
46
8k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
430
Embracing the Ebb and Flow
colly
88
5k
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