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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
CSC307 Lecture 15
javiergs
PRO
0
200
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
130
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
120
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
8
2.2k
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
1
360
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
320
Ruby x Terminal
a_matsuda
5
550
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
360
NOT A HOTEL - 建築や人と融合し、自由を創り出すソフトウェア
not_a_hokuts
2
510
15年目のiOSアプリを1から作り直す技術
teakun
0
580
Rails Girls Tokyo 18th GMO Pepabo Sponsor Talk
yutokyokutyo
0
190
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
12
7.1k
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
187
22k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
150
It's Worth the Effort
3n
188
29k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
460
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
How to make the Groovebox
asonas
2
2k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
77
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