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
250
Railsgirls: Where did my HTML and CSS go
bjelli
0
440
Berufe im World Wide Web
bjelli
0
180
Teach (all the) Rails
bjelli
0
430
Ruby One-Liners
bjelli
1
330
Other Decks in Programming
See All in Programming
Native Federation: The Future of Micro Frontends in Angular
manfredsteyer
PRO
0
170
Escolhendo (ou não) o melhor ORM para o seu projeto
andreiacsilva
1
160
How to improve maintainability and readability of your automated tests? ( #scrumniigata )
teyamagu
PRO
1
130
ペパボOpenTelemetry革命
pyama86
2
1k
CREってこういうこと? 体験入社 - 提案資料 - / what-is-cre-trial-employment
shinden
1
620
Deep Dive into React Stream/Serialize
mugi_uno
4
860
Exploring Type-Informed Lint Rules in Rust based TypeScript Linters
unvalley
3
630
ソースコードを美しくたもつために ~コードレビューの認知限界を突破し、年間400リリースを達成する~
kotauchisunsun
1
740
TypeScriptで使いやすいOpenAPIの書き方
yukimochi_dwango
1
860
Findy - エンジニア向け会社紹介 / Findy Letter for Engineers
findyinc
2
74k
Exploring the Implementation of “t.Run”, “t.Parallel”, and “t.Cleanup”
akarin
1
160
仕様と実装で学ぶOpenTelemetry
drumato
2
1k
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
20
1.8k
The Invisible Customer
myddelton
114
12k
StorybookのUI Testing Handbookを読んだ
zakiyama
13
4.7k
[RailsConf 2023] Rails as a piece of cake
palkan
28
4.1k
Teambox: Starting and Learning
jrom
128
8.4k
Art, The Web, and Tiny UX
lynnandtonic
290
19k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
8
3.5k
Building Adaptive Systems
keathley
32
1.9k
Build your cross-platform service in a week with App Engine
jlugia
226
17k
4 Signs Your Business is Dying
shpigford
176
21k
What's in a price? How to price your products and services
michaelherold
238
11k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
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