File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
1-js/08-prototypes/03-native-prototypes/2-defer-to-prototype-extended Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ function f(a, b) {
1313 alert ( a + b );
1414}
1515
16- f .defer (1000 )(1 , 2 ); // shows 3 after 1 sec
16+ f .defer (1000 )(1 , 2 ); // menampilkan 3 setelah 1 detik
1717```
1818
19- Please note: we use ` this ` in ` f.apply ` to make our decoration work for object methods .
19+ Ingatlah: kita menggunakan ` this ` didalam ` f.apply ` untuk membuat dekorasi kita bekerja untuk metode objek .
2020
21- So if the wrapper function is called as an object method, then ` this ` is passed to the original method ` f ` .
21+ Jadi jika pembungkus fungsinya dipanggil sebagai metode objek, maka ` this ` diberikan kepada metode asli ` f ` .
2222
2323``` js run
2424Function .prototype .defer = function (ms ) {
Original file line number Diff line number Diff line change 1- importance : 4
1+ nilai : 4
22
33---
44
5- # Add the decorating "defer()" to functions
5+ # Menambah dekorasi "defer()" ke fungsi.
66
7- Add to the prototype of all functions the method ` defer(ms) ` , that returns a wrapper, delaying the call by ` ms ` milliseconds .
7+ Tambahkan prototype dari semua fungsi metode ` defer(ms)` , yang mengembalikan pembungkus, menunda pemanggilan dengan ` ms ` milidetik .
88
9- Here's an example of how it should work :
9+ Contoh :
1010
1111``` js
1212function f (a , b ) {
1313 alert ( a + b );
1414}
1515
16- f .defer (1000 )(1 , 2 ); // shows 3 after 1 second
16+ f .defer (1000 )(1 , 2 ); // tampilkan 3 setelah 1 detik
1717```
1818
19- Please note that the arguments should be passed to the original function .
19+ Perhatikan bahwa argumennya harus diberikan ke fungsi aslinya .
You can’t perform that action at this time.
0 commit comments