Skip to content

Commit c8bc878

Browse files
authored
Merge pull request BonsaiDen#336 from serv-inc/master
semicola to terminate function expressions
2 parents a6e75bc + 70375c6 commit c8bc878

File tree

15 files changed

+44
-35
lines changed

15 files changed

+44
-35
lines changed

doc/by/function/this.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
// this спасылаецца на глабальны аб'ект
6363
}
6464
test();
65-
}
65+
};
6666

6767
Памылковым меркаваннем будзе тое, што `this` унутры `test` будзе спасылацца на
6868
`Foo`; Але на самрэч **гэта не так**.
@@ -76,7 +76,7 @@
7676
// Тут выкарыстоўвайце self замест this
7777
}
7878
test();
79-
}
79+
};
8080

8181
`self` гэта звычайнае імя пераменнай, але яно часта выкарыстоўваецца для спасылкі
8282
на знешні `this`. У камбінацыі з [замыканнямі](#function.closures), яно можа быць
@@ -90,7 +90,7 @@
9090
// this цяпер спасылаецца на Foo
9191
}.bind(this);
9292
test();
93-
}
93+
};
9494

9595
### Прысвойванне метадаў
9696

doc/en/function/this.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ mis-design of the language because it **never** has any practical use.
6363
// this is set to the global object
6464
}
6565
test();
66-
}
66+
};
6767

6868
A common misconception is that `this` inside of `test` refers to `Foo`; while in
6969
fact, it **does not**.
@@ -77,7 +77,7 @@ local variable inside of `method` that refers to `Foo`.
7777
// Use self instead of this here
7878
}
7979
test();
80-
}
80+
};
8181

8282
`self` is just a normal variable name, but it is commonly used for the reference to an
8383
outer `this`. In combination with [closures](#function.closures), it can also
@@ -90,7 +90,7 @@ As of ECMAScript 5 you can use the `bind` method combined with an anonymous func
9090
// this now refers to Foo
9191
}.bind(this);
9292
test();
93-
}
93+
};
9494

9595
### Assigning Methods
9696

doc/es/function/this.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ mal diseño del lenguaje, ya que **nunca** tiene un uso práctico.
6363
// this es establecido como un objeto global
6464
}
6565
test();
66-
}
66+
};
6767

6868
Un error común es que `this` dentro de `test` haga referencia a `Foo`, mientras que en
6969
realidad esto **no es así**.
@@ -77,7 +77,7 @@ dentro del `método` para referirse a `Foo`.
7777
// Use that instead of this here
7878
}
7979
test();
80-
}
80+
};
8181

8282
`that` es justo un nombre normal, pero es comúnmente usado para referenciar a `this`
8383
de forma externa. En combinación con [closures](#function.closures), esto puede ser

doc/fi/function/this.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Useimmat näistä tapauksista ovat järkeviä. Ensimmäistä niistä tosin voida
5151
// this asettuu globaaliin olioon
5252
}
5353
test();
54-
}
54+
};
5555

5656
Yleisesti luullaan, että test-funktion sisältämä `this` viittaa tässä tapauksessa `Foo`-olioon. Todellisuudessa se **ei** kuitenkaan tee näin.
5757

@@ -63,7 +63,7 @@ Jotta `Foo`-olioon voidaan päästä käsiksi `test`-funktion sisällä, tulee m
6363
// Käytä thatia thissin sijasta
6464
}
6565
test();
66-
}
66+
};
6767

6868
`that` on normaali nimi, jota käytetään yleisesti viittaamaan ulompaan `this`-muuttujaan. [Sulkeumia](#function.closures) käytettäessä `this`-arvoa voidaan myös välittää edelleen.
6969

doc/fr/function/this.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Bien que la plupart de ces cas ont du sens, le premier cas peut être considér
5252
// this réfère à l'objet global
5353
}
5454
test();
55-
}
55+
};
5656

5757
Une autre erreur souvent commise est que `this` l'intérieur de `test` se réfère à `foo`; ce qui n'est **pas** du tout le cas.
5858

@@ -64,7 +64,7 @@ Pour accéder à `foo` de l'intérieur de `test`, vous pouvez créer une variabl
6464
// Utilisez self au lieu de this ici
6565
}
6666
test();
67-
}
67+
};
6868

6969
`self` est juste une variable normale, couramment utilisée pour référencer un `this` extérieur. Combiné avec des [fermetures](# function.closures) "closures", on peut l'utiliser pour passer les valeurs de `this`.
7070

@@ -75,7 +75,7 @@ Pour accéder à `foo` de l'intérieur de `test`, vous pouvez créer une variabl
7575
// maintenant, this réfère à Foo
7676
}.bind(this);
7777
test();
78-
}
78+
};
7979

8080
### Assignement de méthodes
8181

doc/hu/function/this.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ praktikus felhasználási módja.
6363
// A this itt a globális ojjektum.
6464
}
6565
test();
66-
}
66+
};
6767

6868
Gyakori hiba, hogy úgy gondolják a fenti példában az emberek, hogy a `this` a `test` függvényen
6969
belül az őt körülvevő `Foo`-ra fog mutatni, pedig **nem**.
@@ -77,7 +77,7 @@ lokálisan elhelyezni a `method`-on belül, ami már valóban a kívánt `this`-
7777
// Használjuk a that-et a this helyett
7878
}
7979
test();
80-
}
80+
};
8181

8282
A `that` tuladjonképpen egy mezei változónév (nem kulcsszó), de sokszor használják arra,
8383
hogy egy másik `this`-re hivatkozzanak vele. A [colsureökkel](#function.closures) kombinálva

doc/it/function/this.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ uso pratico.
6666
// this viene impostato all'oggetto globale
6767
}
6868
test();
69-
}
69+
};
7070

7171
Una comune credenza è che `this` all'interno di `test` faccia riferimento a
7272
`Foo` mentre, invece, **non** è così.
@@ -80,7 +80,7 @@ una variabile locale all'interno di `method` che faccia riferimento a `Foo`.
8080
// Qui viene usato self invece di this
8181
}
8282
test();
83-
}
83+
};
8484

8585
`self` è solo un normale nome di variabile, ma viene comunemente usato come
8686
riferimento ad un `this` più esterno. Abbinato alle [closures](#function.closures)
@@ -94,7 +94,7 @@ con una funziona anonima
9494
// this ora fa riferimento a Foo
9595
}.bind(this);
9696
test();
97-
}
97+
};
9898

9999
### Metodi di asseganzione
100100

doc/ja/function/this.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ JavaScriptの`this`と名付けられた特殊なキーワードは他のプロ
5555
// このファンクションはグローバルオブジェクトに設定される
5656
}
5757
test();
58-
}
58+
};
5959

6060
良くある誤解として`test`の中の`this``Foo`を参照しているというものがありますが、そのような事実は**一切**ありません。
6161

@@ -67,7 +67,7 @@ JavaScriptの`this`と名付けられた特殊なキーワードは他のプロ
6767
// ここでthisの代わりに使用する
6868
}
6969
test();
70-
}
70+
};
7171

7272
`that`は通常の変数名ですが、外部の`this`の参照の為に良く使われます。[クロージャ](#function.closures)と組み合わせる事で`this`の値を渡す事ができるようになります。
7373

doc/ko/function/this.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Global Scope에서도 this가 사용될 수 있고 이때에는 *Global* 객체
5151
// 여기에서 this는 Global 객체를 가리킨다.
5252
}
5353
test();
54-
}
54+
};
5555

5656
`test` 에서 `this``Foo`를 가리킬 것으로 생각할 테지만 틀렸다. 실제로는 그렇지 않다.
5757

@@ -63,7 +63,7 @@ Global Scope에서도 this가 사용될 수 있고 이때에는 *Global* 객체
6363
// 여기에서 this 대신에 self를 사용하여 Foo에 접근한다
6464
}
6565
test();
66-
}
66+
};
6767

6868
`self`는 통상적인 변수 이름이지만, 바깥쪽의 `this`를 참조하기 위해 일반적으로 사용된다.
6969
또한 [클로저](#function.closures)와 결합하여 `this`의 값을 주고 받는 용도로 사용할 수도 있다.
@@ -75,7 +75,7 @@ ECMAScript 5부터는 익명 함수와 결합된 `bind` 메소드를 사용하
7575
// this는 이제 Foo를 참조한다
7676
}.bind(this);
7777
test();
78-
}
78+
};
7979

8080
### Method 할당하기
8181

doc/pl/function/this.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ w praktyce.
6363
// wewnątrz tej funkcji this wskazuje na obiekt global
6464
}
6565
test();
66-
}
66+
};
6767

6868
Powszechnym błędem jest myślenie, że `this` wewnątrz `test` wskazuje na `Foo`,
6969
podczas gdy w rzeczywistości tak **nie jest**.
@@ -77,7 +77,7 @@ metody lokalnej zmiennej, która będzie wskazywała na `Foo`.
7777
// Należy używać that zamiast this wewnątrz tej funkcji
7878
}
7979
test();
80-
}
80+
};
8181

8282
`that` jest zwykłą zmienną, ale jest to powszechnie stosowana konwencja otrzymywania
8383
wartości zewnętrznego `this`. W połączeniu z [domknięciami(closures)](#function.closures),

doc/ptbr/function/this.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ como um engano de concepção da linguagem, já que **nunca** se mostrou útil.
6161
// this referencia o objeto global
6262
}
6363
test();
64-
}
64+
};
6565

6666
Um erro comum é achar que `this` dentro de `test` referencia `Foo`; enquanto que, na realidade
6767
**não é isto que acontece**.
@@ -75,7 +75,7 @@ uma variável global dentro do método para se referir à `Foo`.
7575
// Utilize that no lugar de this aqui
7676
}
7777
test();
78-
}
78+
};
7979

8080
`that` trata-se de uma variável normal, porém é normalmente utilizada para referências externas de `this`.
8181
Quando combinadas com [closures](#function.closures), também podem ser utilizadas para repassar `this` como valor.

doc/ru/function/this.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
// this ссылается на глобальный объект
5252
}
5353
test();
54-
}
54+
};
5555

5656
Распространенным заблуждением будет то, что `this` внутри `test` ссылается на `Foo`, но это **не так**.
5757

@@ -63,7 +63,7 @@
6363
// Здесь используем that вместо this
6464
}
6565
test();
66-
}
66+
};
6767

6868
Подходящее имя для переменной - `that`, его часто используют для ссылки на внешний `this`. В комбинации с [замыканиями](#function.closures) `this` можно пробрасывать в глобальную область или в любой другой объект.
6969

doc/tr/function/this.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ kullanılımı yoktur.
6565
// this genel nesneye işaret eder
6666
}
6767
test();
68-
}
68+
};
6969

7070
Bir başka yanılgı `test` fonksiyonunun içinde `this` 'in `Foo` 'ya işaret
7171
edeceğinin sanılmasıdır, ama bu **doğru değildir**.
@@ -79,7 +79,7 @@ değişken oluşturmaktır.
7979
// Burada this yerine that kullanın
8080
}
8181
test();
82-
}
82+
};
8383

8484
`that` kelimesinin dilde özel bir anlamı yoktur, ama sıklıkla dış kapsamdaki
8585
`this` 'e işaret etmek için kullanılır. Bu yöntem [`closure`](#function.closures)

doc/zh/function/this.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ JavaScript 有一套完全不同于其它语言的对 `this` 的处理机制。
6161
// this 将会被设置为全局对象(译者注:浏览器环境中也就是 window 对象)
6262
}
6363
test();
64-
}
64+
};
6565

6666
一个常见的误解是 `test` 中的 `this` 将会指向 `Foo` 对象,实际上**不是**这样子的。
6767

@@ -73,7 +73,7 @@ JavaScript 有一套完全不同于其它语言的对 `this` 的处理机制。
7373
// 使用 that 来指向 Foo 对象
7474
}
7575
test();
76-
}
76+
};
7777

7878
`that` 只是我们随意起的名字,不过这个名字被广泛的用来指向外部的 `this` 对象。
7979
[闭包](#function.closures) 一节,我们可以看到 `that` 可以作为参数传递。

doc/zhtw/function/this.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ mis-design of the language because it **never** has any practical use.
5959
// this is set to the global object
6060
}
6161
test();
62-
}
62+
};
6363

6464
A common misconception is that `this` inside of `test` refers to `Foo`; while in
6565
fact, it **does not**.
@@ -73,12 +73,21 @@ local variable inside of `method` that refers to `Foo`.
7373
// Use that instead of this here
7474
}
7575
test();
76-
}
76+
};
7777

7878
`that` is just a normal variable name, but it is commonly used for the reference to an
7979
outer `this`. In combination with [closures](#function.closures), it can also
8080
be used to pass `this` values around.
8181

82+
As of ECMAScript 5 you can use the `bind` method combined with an anonymous function to achieve the same result.
83+
84+
Foo.method = function() {
85+
var test = function() {
86+
// this now refers to Foo
87+
}.bind(this);
88+
test();
89+
};
90+
8291
### Assigning Methods
8392

8493
Another thing that does **not** work in JavaScript is function aliasing, which is

0 commit comments

Comments
 (0)