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
890
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
310
Railsgirls: Where did my HTML and CSS go
bjelli
0
530
Berufe im World Wide Web
bjelli
0
230
Teach (all the) Rails
bjelli
0
440
Ruby One-Liners
bjelli
1
330
Other Decks in Programming
See All in Programming
AI時代のリアーキテクチャ戦略 / Re-architecture Strategy in the AI Era
dachi023
0
190
Parallel::Pipesの紹介
skaji
2
870
❄️ tmux-nixの実装を通して学ぶNixOSモジュール
momeemt
1
120
少数精鋭エンジニアがフルスタック力を磨く理由 -そしてAI時代へ-
rebase_engineering
0
130
MLOps Japan 勉強会 #52 - 特徴量を言語を越えて一貫して管理する, 『特徴量ドリブン』な MLOps の実現への試み
taniiicom
2
570
Spring gRPC で始める gRPC 入門 / Introduction to gRPC with Spring gRPC
mackey0225
0
110
Interface vs Types ~型推論が過多推論~
hirokiomote
1
230
Design Pressure
hynek
0
1.4k
抽象データ型について学んだ
ryounasso
0
210
Agent Rules as Domain Parser
yodakeisuke
1
340
技術懸念に立ち向かい 法改正を穏便に乗り切った話
pop_cashew
0
790
Rethinking Data Access: The New httpResource in Angular
manfredsteyer
PRO
0
220
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
GitHub's CSS Performance
jonrohan
1031
460k
It's Worth the Effort
3n
184
28k
4 Signs Your Business is Dying
shpigford
183
22k
Writing Fast Ruby
sferik
628
61k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.8k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
460
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
34k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
228
22k
RailsConf 2023
tenderlove
30
1.1k
Building an army of robots
kneath
306
45k
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