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
910
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Javascript Closures
a short introduction (in javascript + german)
bjelli
July 18, 2012
More Decks by bjelli
See All by bjelli
Intro to Web- and Mobile-Developement
bjelli
0
330
Railsgirls: Where did my HTML and CSS go
bjelli
0
620
Berufe im World Wide Web
bjelli
0
270
Teach (all the) Rails
bjelli
0
450
Ruby One-Liners
bjelli
1
350
Other Decks in Programming
See All in Programming
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
200
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
250
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
200
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.7k
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
0
130
一参加者から『中の人』へ 〜全通PHPerがブースに立って学んだ、カンファレンスを100倍楽しむコツ〜
wp_daisuke
0
110
FastAPI の並行処理モデルを完全に理解する
hoto17296
9
3.7k
数年滞っていたダークモード対応をおよそ2週間で完了させる
chigichan24
0
660
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
120
ソフトウェアラスタライザ
fadis
1
780
Hono + Inertia + React で LP を構築した話
oukayuka
2
200
Featured
See All Featured
How to Ace a Technical Interview
jacobian
281
24k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Marketing to machines
jonoalderson
1
5.7k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
490
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
430
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
230
The Spectacular Lies of Maps
axbom
PRO
1
970
Writing Fast Ruby
sferik
630
63k
The Invisible Side of Design
smashingmag
301
52k
Exploring anti-patterns in Rails
aemeredith
3
490
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
270
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
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