Skip to content

Commit 44b8253

Browse files
committed
Translation
Translation js/advanced-functions/bind/...
1 parent 19b75f6 commit 44b8253

File tree

10 files changed

+41
-41
lines changed

10 files changed

+41
-41
lines changed

1-js/06-advanced-functions/10-bind/2-write-to-object-after-bind/solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The answer: `null`.
1+
Jawabannya: `null`.
22

33

44
```js run
@@ -13,6 +13,6 @@ let user = {
1313
user.g();
1414
```
1515

16-
The context of a bound function is hard-fixed. There's just no way to further change it.
16+
Konteks dari pengikatan fungsi sangat sulit diperbaiki. Tidak ada cara untuk merubahnya dilain waktu.
1717

18-
So even while we run `user.g()`, the original function is called with `this=null`.
18+
Jadi bahkan ketika kita menjalankan `user.g()`, fungsi aslinya dipanggil dengan `this=null`.

1-js/06-advanced-functions/10-bind/2-write-to-object-after-bind/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
importance: 5
1+
nilai penting: 5
22

33
---
44

5-
# Bound function as a method
5+
# Ikat fungsi sebagai sebuah metode
66

7-
What will be the output?
7+
Apakah keluarannya?
88

99
```js
1010
function f() {

1-js/06-advanced-functions/10-bind/3-second-bind/solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The answer: **John**.
1+
Jawabannya: **John**.
22

33
```js run no-beautify
44
function f() {
@@ -10,6 +10,6 @@ f = f.bind( {name: "John"} ).bind( {name: "Pete"} );
1010
f(); // John
1111
```
1212

13-
The exotic [bound function](https://tc39.github.io/ecma262/#sec-bound-function-exotic-objects) object returned by `f.bind(...)` remembers the context (and arguments if provided) only at creation time.
13+
Objek eksotis [bound function](https://tc39.github.io/ecma262/#sec-bound-function-exotic-objects) yang dikembalikan oleh `f.bind(...)` mengingat konteksnya (dan argumen jika ada) hanya pada waktu pembuatan.
1414

15-
A function cannot be re-bound.
15+
Sebuah fungsi tidak bisa diikat-ulang.

1-js/06-advanced-functions/10-bind/3-second-bind/task.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
importance: 5
1+
nilai penting: 5
22

33
---
44

5-
# Second bind
5+
# Pengikatan kedua
66

7-
Can we change `this` by additional binding?
7+
Bisakah kita merubah`this` dengan pengikatan tambahan?
88

9-
What will be the output?
9+
Apakah yang akan menjadi keluarannya?
1010

1111
```js no-beautify
1212
function f() {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The answer: `undefined`.
1+
Jawabannya: `undefined`.
22

3-
The result of `bind` is another object. It does not have the `test` property.
3+
Hasil dari `bind` adalah objek lainnya. Objek tersebut tidak memiliki properti `test`.
44

1-js/06-advanced-functions/10-bind/4-function-property-after-bind/task.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
importance: 5
1+
nilai penting: 5
22

33
---
44

5-
# Function property after bind
5+
# Properti fungsi setelah pengikatan
66

7-
There's a value in the property of a function. Will it change after `bind`? Why, or why not?
7+
Terdapat sebuah nilai didalam properti dari sebuah fungsi. Apakah properti tersebut akan berubah setelah `bind`? Kenapa, atau kenapa tidak?
88

99
```js run
1010
function sayHi() {
@@ -17,7 +17,7 @@ let bound = sayHi.bind({
1717
name: "John"
1818
});
1919

20-
alert( bound.test ); // what will be the output? why?
20+
alert( bound.test ); // apakah keluarannya? kenapa?
2121
*/!*
2222
```
2323

1-js/06-advanced-functions/10-bind/5-question-use-bind/solution.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
The error occurs because `ask` gets functions `loginOk/loginFail` without the object.
2+
Errornya muncul karena `ask` mendapatkan fungsi `loginOk/loginFail` tanpa objeknya.
33

4-
When it calls them, they naturally assume `this=undefined`.
4+
ketika `ask` memanggil, `loginOk/loginFail` mengasumsikan bahwa `this=undefined`.
55

6-
Let's `bind` the context:
6+
Ayo kita coba `bind` konteksnya:
77

88
```js run
99
function askPassword(ok, fail) {
@@ -30,14 +30,14 @@ askPassword(user.loginOk.bind(user), user.loginFail.bind(user));
3030
*/!*
3131
```
3232

33-
Now it works.
33+
Sekarang kodenya berjalan.
3434

35-
An alternative solution could be:
35+
Alternatif lainnya bisa menggunakan:
3636
```js
3737
//...
3838
askPassword(() => user.loginOk(), () => user.loginFail());
3939
```
4040

41-
Usually that also works and looks good.
42-
43-
It's a bit less reliable though in more complex situations where `user` variable might change *after* `askPassword` is called, but *before* the visitor answers and calls `() => user.loginOk()`.
41+
Contoh diatas biasanya bekerja dan terlihat lebih rapih.
42+
43+
Cara ini sedikit kurang bisa digunakan didalam situasi yang lebih kompleks dimana variabel `user` mungkin berubah *setelah* `askPassword` dipanggil, tapi *sebelum* pengguna menjawab dan memanggil `() => user.loginOk()`.

1-js/06-advanced-functions/10-bind/5-question-use-bind/task.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
importance: 5
1+
nilai penting: 5
22

33
---
44

5-
# Fix a function that loses "this"
5+
# Perbaiki sebuah fungsi yang telah kehilangan "this"
66

7-
The call to `askPassword()` in the code below should check the password and then call `user.loginOk/loginFail` depending on the answer.
7+
Pemanggilan kepada `askPassword()` didalam kode dibawah harus memeriksa passwordnya dan lalu memanggil `user.loginOk/loginFail` tergantung dari jawabannya.
88

9-
But it leads to an error. Why?
9+
Tapi pemanggilan itu mengembalikan sebuah error. kenapa?
1010

11-
Fix the highlighted line for everything to start working right (other lines are not to be changed).
11+
Perbaiki baris yang di tandai agar kodenya dapat berjalan dengan benar (baris lainnya tidak perlu diubah).
1212

1313
```js run
1414
function askPassword(ok, fail) {

1-js/06-advanced-functions/10-bind/6-ask-partial/solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

22

3-
1. Either use a wrapper function, an arrow to be concise:
3+
1. Funakan fungsi pembungkus, lebih jelasnya gunakanlah fungsi arrow:
44

55
```js
66
askPassword(() => user.login(true), () => user.login(false));
77
```
88

9-
Now it gets `user` from outer variables and runs it the normal way.
9+
Sekarang fungsi `user dapat diambil dari variabel luar dan dijalankan dengan normal.
1010
11-
2. Or create a partial function from `user.login` that uses `user` as the context and has the correct first argument:
11+
2. Atau buat sebuah fungsi mini dari `user.login` yang menggunakan `user` sebagai konteksnya dan yang mana mempunyai argumen pertama yang benar:
1212
1313
1414
```js

1-js/06-advanced-functions/10-bind/6-ask-partial/task.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
importance: 5
1+
nilai penting: 5
22

33
---
44

5-
# Partial application for login
5+
# Pengaplikasian parsial untuk login
66

7-
The task is a little more complex variant of <info:task/question-use-bind>.
7+
Tugas yang ini adalah varian yang sedikit lebih sulit daripada <info:task/question-use-bind>.
88

9-
The `user` object was modified. Now instead of two functions `loginOk/loginFail`, it has a single function `user.login(true/false)`.
9+
Objek `user`nya telah dimodifikasi. Sekarang daripada menggunakan dua fungsi `loginOk/loginFail`, sekarang hanya memiliki satu fungsi `user.login(true/false)`.
1010

11-
What should we pass `askPassword` in the code below, so that it calls `user.login(true)` as `ok` and `user.login(false)` as `fail`?
11+
Apa yang harus kita kirimkan kedalam `askPassword` di kode dibawah, apakah harus memanggul `user.login(true)` sebagai `ok` dan `user.login(false)` sebagai `fail`?
1212

1313
```js
1414
function askPassword(ok, fail) {
@@ -30,5 +30,5 @@ askPassword(?, ?); // ?
3030
*/!*
3131
```
3232
33-
Your changes should only modify the highlighted fragment.
33+
Ubahlah kodenya hanya pada bagian yang ditandai.
3434

0 commit comments

Comments
 (0)