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
860
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
240
Railsgirls: Where did my HTML and CSS go
bjelli
0
430
Berufe im World Wide Web
bjelli
0
180
Teach (all the) Rails
bjelli
0
430
Ruby One-Liners
bjelli
1
320
Other Decks in Programming
See All in Programming
PHPの次期バージョンはこの時期どうなっているのか - Internalsの開発体制について - PHPカンファレンス小田原
youkidearitai
PRO
1
190
デフォルトにして至高、RubyMineの大好きな所
ruzia
0
360
try! Swift Tokyo 初参加報告LT
hinakko2
0
220
1BRC--Nerd Sniping the Java Community
gunnarmorling
0
340
Kotlin Multiplatform at Stable and Beyond (Android Makers 2024)
zsmb
0
210
はてなにおける CSS Modules、及び CSS Modules に足りないもの / CSS Modules in Hatena, and CSS Modules missing parts
mizdra
7
930
見た目から始める生産性向上
ikumatadokoro
7
840
サイコロで理解する統計的仮説検定の考え方
tatamiya
4
930
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
1
180
エンターテイメント業界で利用されるAWS
demuyan
0
210
Anthropic Cookbook のおすすめレシピ
schroneko
7
950
Git Lint
bkuhlmann
4
750
Featured
See All Featured
The Invisible Side of Design
smashingmag
294
49k
How to Ace a Technical Interview
jacobian
272
22k
Six Lessons from altMBA
skipperchong
21
3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
14
1.6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
19
1.7k
Making Projects Easy
brettharned
108
5.5k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
274
13k
The Mythical Team-Month
searls
216
42k
Building a Modern Day E-commerce SEO Strategy
aleyda
17
6.4k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
30
6k
The MySQL Ecosystem @ GitHub 2015
samlambert
243
12k
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