Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
f0c55ba
FIX: change ; to ,
leviding Oct 15, 2020
fe3ba11
OPT: change "false" to "falsy"
leviding Oct 15, 2020
d6f98e1
Fix a possible typo in 1.6.1
vsemozhetbyt Oct 15, 2020
187e8e1
Fix a typo in 1.6.1 task solution
vsemozhetbyt Oct 15, 2020
de8cf9f
FIX: delete extra space
leviding Oct 17, 2020
2f822c8
Fix semicolons in 1.11.1 (Introduction: callbacks)
vsemozhetbyt Oct 30, 2020
c3979cd
Fix typo.
odsantos Oct 31, 2020
0b6cfc9
Update article.md
johnjacobkenny Oct 31, 2020
1236996
Fix a typo in 1.11.3 (Promises chaining)
vsemozhetbyt Oct 31, 2020
d5a88b6
Fix semicolons in 1.11.6 (Promisification)
vsemozhetbyt Oct 31, 2020
37c6a31
Fix semicolons, remove old note in 1.11.8
vsemozhetbyt Oct 31, 2020
58d9f75
Fix typo in 1.11.6 (Promisification)
vsemozhetbyt Nov 1, 2020
0bdf17e
Fix Optional chaining doc
satyambnsal Nov 1, 2020
05dfb56
Fix typo, add note in 1.12.2 (Async iteration)
vsemozhetbyt Nov 1, 2020
ec81513
Change `var` to `let` in 7.16 regexp-sticky
wam Nov 1, 2020
4e9a335
Correct comment in 1.13.1
vsemozhetbyt Nov 1, 2020
b83f2d7
Fix typos in 'Proxy and Reflect'
vsemozhetbyt Nov 4, 2020
422ef44
Fix outdated note in 1.99.04 (Reference Type)
vsemozhetbyt Nov 5, 2020
e25caae
Correct solution explanation in 1.99.04 (Reference Type)
vsemozhetbyt Nov 5, 2020
bf3c878
Fix link in 2.1.5 (Node properties...)
vsemozhetbyt Nov 5, 2020
b589f38
Merge pull request #2210 from leviding/patch-27
iliakan Nov 9, 2020
9e99c36
Merge pull request #2249 from vsemozhetbyt/patch-9
iliakan Nov 9, 2020
bd23930
Update article.md
leviding Nov 9, 2020
8f91294
Fix typos in 2.1.4 (Searching elements)
vsemozhetbyt Nov 9, 2020
a914bad
fix typo in 06-promisify article.md
ZhaoMuwei Nov 10, 2020
27f6935
Merge pull request #2250 from odsantos/fix-regexp-char-class-typo
iliakan Nov 10, 2020
fd6861e
Merge pull request #2251 from johnjacobkenny/patch-1
iliakan Nov 10, 2020
12a5cb0
Merge pull request #2252 from vsemozhetbyt/patch-10
iliakan Nov 10, 2020
ca9a022
Revert "Fix a typo in 1.11.3 (Promises chaining)"
iliakan Nov 10, 2020
032e18b
Merge pull request #2278 from javascript-tutorial/revert-2252-patch-10
iliakan Nov 10, 2020
2ff5eeb
Merge pull request #2255 from vsemozhetbyt/patch-11
iliakan Nov 10, 2020
48b111d
Merge pull request #2257 from vsemozhetbyt/1.11.8
iliakan Nov 10, 2020
96b9854
Merge pull request #2258 from vsemozhetbyt/patch-12
iliakan Nov 10, 2020
f782e9c
Merge pull request #2259 from satyambnsal/master
iliakan Nov 10, 2020
eba2280
Merge pull request #2260 from vsemozhetbyt/patch-13
iliakan Nov 10, 2020
21d44a0
Merge pull request #2261 from wam/change-var-to-let-in-regexp-sticky-…
iliakan Nov 10, 2020
e9a528f
Merge pull request #2262 from vsemozhetbyt/patch-14
iliakan Nov 10, 2020
bbe7e05
Merge pull request #2266 from vsemozhetbyt/1.99.1
iliakan Nov 10, 2020
876fded
Merge pull request #2270 from vsemozhetbyt/patch-15
iliakan Nov 10, 2020
2f4c29c
Merge pull request #2271 from vsemozhetbyt/patch-16
iliakan Nov 10, 2020
26b393a
Merge pull request #2272 from vsemozhetbyt/patch-17
iliakan Nov 10, 2020
a4194ce
look like ninja code
lumosmind Nov 10, 2020
211db88
Fix typo in 2.1.6 (Attributes and properties)
vsemozhetbyt Nov 10, 2020
59a2f34
Fix a typo in 1.11.3 (Promises chaining)
vsemozhetbyt Nov 10, 2020
7cb6387
Merge pull request #2281 from vsemozhetbyt/patch-10
iliakan Nov 11, 2020
29a7b66
Update article.md
iliakan Nov 11, 2020
fab613d
Merge pull request #2280 from vsemozhetbyt/patch-11
iliakan Nov 11, 2020
fd08e1c
Merge pull request #2279 from lumosmind/patch-53
iliakan Nov 11, 2020
22cf4b6
Merge pull request #2277 from ZhaoMuwei/patch-1
iliakan Nov 11, 2020
5607c77
Merge pull request #2276 from vsemozhetbyt/patch-18
iliakan Nov 11, 2020
5d7cba3
Merge pull request #2275 from leviding/patch-30
iliakan Nov 11, 2020
32d4f13
Merge pull request #2205 from vsemozhetbyt/patch-8
iliakan Nov 11, 2020
ad4bd59
Merge pull request #2204 from vsemozhetbyt/patch-7
iliakan Nov 11, 2020
611236f
Merge pull request #2203 from leviding/patch-25
iliakan Nov 11, 2020
331fafd
Merge pull request #2202 from leviding/patch-24
iliakan Nov 11, 2020
99e59ba
Update article.md
iliakan Nov 15, 2020
2f0c37d
fixes
iliakan Nov 22, 2020
23da191
minor fixes
iliakan Nov 22, 2020
2e70ae7
merging all conflicts
iliakan Nov 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 1-js/01-getting-started/4-devtools/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ Supaya bisa melihat error dan memperoleh informasi berfaedah lainnya dari script

Kebanyakan pengembang memakai Chrome atau Firefox untuk pengembangan karena tools pengembangan yang mereka punya paling mantap. Peramban lain punya juga koq, ada with special features, but are usually playing "catch-up" to Chrome or Firefox. So most developers have a "favorite" browser and switch to others if a problem is browser-specific.

<<<<<<< HEAD
Tools pengembang mengandung faedah; mereka punya banyak fitur. Untuk memulainya, kita akan belajar cara membuka mereka, mencari error, dan menjalankan perintah JavaScript.
=======
Developer tools are potent, they have many features. To start, we'll learn how to open them, look at errors, and run JavaScript commands.
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

## Google Chrome

Expand Down
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/01-hello-world/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ Jadi pertama, kita lihat bagaimana kita menyisipkan script ke laman web. Untuk l

## Tag "script"

<<<<<<< HEAD
Program JavaScript bisa disisipkan ke dalam bagian mana saja dari dokumen HTML dengan bantuan tag `<script>`.
=======
JavaScript programs can be inserted almost anywhere into an HTML document using the `<script>` tag.
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

Contoh:

Expand Down
4 changes: 4 additions & 0 deletions 1-js/04-object-basics/01-object/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ let user = {
```
Itu disebut koma "buntut" atau "menggantung". Memudahkan kita menambah/menghapus/memindahkan properti, karena semua barus menjadi mirip.

<<<<<<< HEAD
````smart header="Objek dengan const bisa diubah"
Perhatikan: sebuah object yang dideklarasikan dengan `const` *bisa* diubah.

Expand All @@ -117,6 +118,9 @@ Ada cara lain untuk mengubah properti objek konstan(constant), kita akan mengula
````

## Kurung siku
=======
## Square brackets
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

Untuk properti multi-kata, akses dot tak bekerja:

Expand Down
31 changes: 31 additions & 0 deletions 1-js/04-object-basics/02-object-copy/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ admin.name = 'Pete'; // mengganti admin dengan menggunakan "referensi"
alert(*!*user.name*/!*); // 'Pete', perubahan akan terlihat pada "user"
```

<<<<<<< HEAD
<<<<<<< HEAD
Contoh diatas mendemonstrasikan bahwa disana hanya ada satu objek. Seperti jika kita punya sebuah lemari dengan dua kunci dan satunya (`admin`) digunakan untuk masuk kedalamnya. Lalu, jika kita nanti menggunakan kunci lainnya (`user`) kita bisa melihat perubahannya.

Expand All @@ -111,6 +112,8 @@ Operator pembanding `==` dan pembanding ketat `===` untuk objek bekerja sama saj
Dibawah adalah dua variabel yang mereferensi ke objek yang sama, dengan demikian mereka sama:
=======

=======
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93
It's just as if we had a cabinet with two keys and used one of them (`admin`) to get into it. Then, if we later use another key (`user`) we can see changes.

## Comparison by reference
Expand Down Expand Up @@ -284,7 +287,35 @@ Kita bisa menggunakan rekursi untuk mengimplementasikannya. Atau, jangan ambil p
We can use recursion to implement it. Or, not to reinvent the wheel, take an existing implementation, for instance [_.cloneDeep(obj)](https://lodash.com/docs#cloneDeep) from the JavaScript library [lodash](https://lodash.com).
>>>>>>> ff152b126ec70a9de919bfdc1913215539d37187

<<<<<<< HEAD
## Ringkasan
=======
```smart header="Const objects can be modified"
An important "side effect" of storing objects as references is that an object declared as `const` *can* be modified.

For instance:

```js run
const user = {
name: "John"
};

*!*
user.name = "Pete"; // (*)
*/!*

alert(user.name); // Pete
```

It might seem that the line `(*)` would cause an error, but no. The value of `user` is constant, it must always reference the same object. But properties of that object are free to change.

In other words, the `const user` gives an error only if we try to set `user=...` as a whole, and that's all.

That said, if we really need to make constant object properties, it's also possible, but using totally different methods, we'll mention that in the chapter <info:property-descriptors>.
```

## Summary
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

objek dibuat dan disalin dengan menggunakan referensi. Dengan kata lain, sebuah variable menyimpan bukanlah "nilai objek", tapi sebuah "referensi" (address/alamat di memori) untuk nilainya. Jadi menyalin sebuah variabel atau memindahkannya sebagai fungsi argumen akan menyalin referensinya, bukan objeknya.

Expand Down
2 changes: 1 addition & 1 deletion 1-js/04-object-basics/07-optional-chaining/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Ini ada cara teraman untuk mengakses `user.address.street`:
=======
In other words, `value?.prop`:
- is the same as `value.prop` if `value` exists,
- otherwise (when `value` is `undefined/null`) it returns that `value`.
- otherwise (when `value` is `undefined/null`) it returns `undefined`.

>>>>>>> dccca58f268ad6d5a6f2160613a8ea3c5cd53a2d
Here's the safe way to access `user.address.street` using `?.`:
Expand Down
4 changes: 4 additions & 0 deletions 1-js/05-data-types/05-array-methods/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -772,8 +772,12 @@ Metode-metode ini adalah yang paling sering digunakan, mencakupi 99% kasus pengg

The function `fn` is called on each element of the array similar to `map`. If any/all results are `true`, returns `true`, otherwise `false`.

<<<<<<< HEAD
These methods behave sort of like `||` and `&&` operators: if `fn` returns a truthy value, `arr.some()` immediately returns `true` and stops iterating over the rest items; if `fn` returns a falsy value, `arr.every()` immediately returns `false` and stops iterating over the rest items as well.
>>>>>>> d6e88647b42992f204f57401160ebae92b358c0d
=======
These methods behave sort of like `||` and `&&` operators: if `fn` returns a truthy value, `arr.some()` immediately returns `true` and stops iterating over the rest items; if `fn` returns a falsy value, `arr.every()` immediately returns `false` and stops iterating over the rest items as well.
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

<<<<<<< HEAD
- [arr.fill(value, start, end)](mdn:js/Array/fill) -- mengisi *array* dengan mengulang `value` dari indeks `start` hingga `end`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<<<<<<< HEAD
Secara definisi, sebuah faktorial adalah `n!` bisa ditulis juga sebagai `n * (n-1)`.
=======
By definition, a factorial `n!` can be written as `n * (n-1)!`.
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

Dengan kata lain, hasil dari `factorial(n)` bisa juga dikalkulasikan sebagai `n` dikalikan dengan hasil dari `factorial(n-1)`. Dan pemanggilan untuk `n-1` bisa secara rekursi menurun, dan terus menurun sampai `1`.

Expand Down
8 changes: 8 additions & 0 deletions 1-js/06-advanced-functions/01-recursion/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ Kita bisa menggambarkannya seperti:
</li>
</ul>

<<<<<<< HEAD
Itu ketika fungsi mulai dieksekusi. Kondisinya `n == 1` adalah false, jadi alurnya berlanjut ke cabang kedua dari `if`:
=======
That's when the function starts to execute. The condition `n == 1` is falsy, so the flow continues into the second branch of `if`:
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

```js run
function pow(x, n) {
Expand Down Expand Up @@ -190,7 +194,11 @@ Konteks eksekusi baru yang sekarang berada di atas (dan jelas), dan konteks yang
Ketika kita menyelesaikan subcall -- itu akan mudah untuk melanjutkan konteks sebelumnya, karena itu tetap menyimpan kedua variabel dan tempat yang tepat dimana kode itu berhenti.

```smart
<<<<<<< HEAD
Disini dialam gambar kita gunakan kata "line", sebagai contoh disana terdapat satu subcall didalam baris, tapi secara umum sebuah baris dari kode mungkin mengandung subcall ganda, seperti `pow(…) + pow(…) + somethingElse(…)`.
=======
Here in the picture we use the word "line", as in our example there's only one subcall in line, but generally a single line of code may contain multiple subcalls, like `pow(…) + pow(…) + somethingElse(…)`.
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

Jadi itu harus menjadi lebih presisi untuk dikatakan eksekusi berlanjut "langsung seterlah subcall".
```
Expand Down
8 changes: 4 additions & 4 deletions 1-js/11-async/01-callbacks/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ loadScript('/my/script.js', function(script) {
});
*/!*

})
});

});
```
Expand Down Expand Up @@ -229,7 +229,7 @@ loadScript('1.js', function(error, script) {
});

}
})
});
}
});
```
Expand Down Expand Up @@ -262,7 +262,7 @@ loadScript('1.js', function(error, script) {
}
});
}
})
});
}
});
-->
Expand Down Expand Up @@ -302,7 +302,7 @@ function step3(error, script) {
} else {
// ...berlanjut setelah semua script dimuat(*)
}
};
}
```

Lihat? Itu sama saja, dan tidak ada sarang yang dalam sekarang karena kita buat setiap action menjadi fungsi top-level yang terpisah.
Expand Down
4 changes: 4 additions & 0 deletions 1-js/11-async/03-promise-chaining/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,11 @@ fetch("/article/promise-chaining/user.json")

Sekarang mari lakukan sesuatu dengan memuat pengguna.

<<<<<<< HEAD
Sebagai contoh, kita dapat membuat satu atau lebih permintaan ke GitHub, muat profil pengguna dan tunjukkan avatarnya:
=======
For instance, we can make one more request to GitHub, load the user profile and show the avatar:
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

```js run
// Buat permintaan ke user.json
Expand Down
10 changes: 10 additions & 0 deletions 1-js/11-async/05-promise-api/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ Jika peramban tidak mendukung `Promise.allSettled`, mudah untuk melakukan polyfi

```js
if (!Promise.allSettled) {
<<<<<<< HEAD
Promise.allSettled = function (promises) {
return Promise.all(
promises.map((p) =>
Expand All @@ -199,6 +200,15 @@ if (!Promise.allSettled) {
)
)
);
=======
const rejectHandler = reason => ({ status: 'rejected', reason });

const resolveHandler = value => ({ status: 'fulfilled', value });

Promise.allSettled = function (promises) {
const convertedPromises = promises.map(p => Promise.resolve(p).then(resolveHandler, rejectHandler));
return Promise.all(convertedPromises);
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93
};
}
```
Expand Down
10 changes: 7 additions & 3 deletions 1-js/11-async/06-promisify/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function promisify(f) {
f.call(this, ...args); // panggil fungsi aslinya
});
};
};
}

// penggunaan:
let loadScriptPromise = promisify(loadScript);
Expand All @@ -113,8 +113,12 @@ The code may look a bit complex, but it's essentially the same that we wrote abo

A call to `promisify(f)` returns a wrapper around `f` `(*)`. That wrapper returns a promise and forwards the call to the original `f`, tracking the result in the custom callback `(**)`.

<<<<<<< HEAD
Here, `promisiefy` assumes that the original function expects a callback with exactly two arguments `(err, result)`. That's what we encounter most often. Then our custom callback is in exactly the right format, and `promisify` works great for such a case.
>>>>>>> dccca58f268ad6d5a6f2160613a8ea3c5cd53a2d
=======
Here, `promisify` assumes that the original function expects a callback with exactly two arguments `(err, result)`. That's what we encounter most often. Then our custom callback is in exactly the right format, and `promisify` works great for such a case.
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

Tetapi bagaimana jika `f` asli mengharapkan callback dengan lebih banyak argumen `callback(err, res1, res2, ...)`?

Expand Down Expand Up @@ -146,11 +150,11 @@ function promisify(f, manyArgs = false) {
f.call(this, ...args);
});
};
};
}

// penggunaan:
f = promisify(f, true);
f(...).then(arrayOfResults => ..., err => ...)
f(...).then(arrayOfResults => ..., err => ...);
```

<<<<<<< HEAD
Expand Down
11 changes: 11 additions & 0 deletions 1-js/11-async/08-async-await/01-rewrite-async/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,24 @@ Tulis ulang salah satu contoh di bab ini <info:promise-chaining> menggunakan `as

```js run
function loadJson(url) {
<<<<<<< HEAD
return fetch(url).then((response) => {
if (response.status == 200) {
return response.json();
} else {
throw new Error(response.status);
}
});
=======
return fetch(url)
.then(response => {
if (response.status == 200) {
return response.json();
} else {
throw new Error(response.status);
}
});
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93
}

loadJson('no-such-user.json')
Expand Down
17 changes: 17 additions & 0 deletions 1-js/11-async/08-async-await/02-rewrite-async-2/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

Di bawah anda dapat menemukan contoh "rethrow" dari bab <info:promise-chaining>. Tulis ulang menggunakan `async/await` daripada `.then/catch`.

<<<<<<< HEAD
Dan singkirkan rekursi yang mendukung masuk loop dalam `demoGithubUser`: dengan `async/await` itu menjadi mudah untuk dilakukan.
=======
Below you can find the "rethrow" example. Rewrite it using `async/await` instead of `.then/catch`.

And get rid of the recursion in favour of a loop in `demoGithubUser`: with `async/await` that becomes easy to do.
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

```js run
class HttpError extends Error {
Expand All @@ -14,13 +20,24 @@ class HttpError extends Error {
}

function loadJson(url) {
<<<<<<< HEAD
return fetch(url).then((response) => {
if (response.status == 200) {
return response.json();
} else {
throw new HttpError(response);
}
});
=======
return fetch(url)
.then(response => {
if (response.status == 200) {
return response.json();
} else {
throw new HttpError(response);
}
});
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93
}

// Tanya nama pengguna sampai github mengembalikkan user yang valid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ Sekarang _value_ datang dengan jeda 1 detik di antara mereka.
```smart
Secara teknis, kita bisa menambahkan `Symbol.iterator` dan `Symbol.asyncIterator` ke objek, jadi keduanya secara sinkron (`for..of`) dan asinkron (`for await..of`) _iterable_.

<<<<<<< HEAD
Namun dalam praktiknya, itu akan menjadi hal yang aneh untuk dilakukan.
=======
In practice though, that would be a weird thing to do.
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93
```

## Contoh kehidupan nyata: _paginated_ data
Expand Down Expand Up @@ -371,10 +375,19 @@ Penjelasan lebih lanjut tentang cara kerjanya:
- URL awalnya adalah `https://api.github.com/repos/<repo>/commits`, dan halaman berikutnya akan berada di `Link` header tanggapan.
- Metode `fetch` memungkinkan kita untuk memberikan otorisasi dan tajuk lainnya jika diperlukan -- di sini GitHub memerlukan `User-Agent`.

<<<<<<< HEAD
2. _commits_ dikembalikan dalam format JSON.
3. Kita harus mendapatkan URL halaman berikutnya dari tajuk `Link` dari respon. Ini memiliki format khusus, jadi kita menggunakan ekspresi reguler untuk itu.
- URL halaman berikutnya mungkin terlihat seperti ini `https://api.github.com/repositories/93253246/commits?page=2`. Ini dihasilkan oleh GitHub itu sendiri.
4. Kemudian kita menghasilkan _commits_ yang diterima satu per satu, dan ketika mereka selesai, iterasi `while(url)` berikutnya akan terpicu, membuat satu permintaan lagi.
=======
- The initial URL is `https://api.github.com/repos/<repo>/commits`, and the next page will be in the `Link` header of the response.
- The `fetch` method allows us to supply authorization and other headers if needed -- here GitHub requires `User-Agent`.
2. The commits are returned in JSON format.
3. We should get the next page URL from the `Link` header of the response. It has a special format, so we use a regular expression for that (we will lern this feature in [Regular expressions](info:regular-expressions)).
- The next page URL may look like `https://api.github.com/repositories/93253246/commits?page=2`. It's generated by GitHub itself.
4. Then we yield the received commits one by one, and when they finish, the next `while(url)` iteration will trigger, making one more request.
>>>>>>> 23da191b58643387783f38e999f5b05be87d3d93

Contoh penggunaan (menunjukkan penulis _commit_ di konsol):

Expand Down
2 changes: 1 addition & 1 deletion 1-js/13-modules/01-modules-intro/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Compare to regular script below:

<script>
*!*
alert(typeof button); // Error: button is undefined, the script can't see elements below
alert(typeof button); // button is undefined, the script can't see elements below
*/!*
// regular scripts run immediately, before the rest of the page is processed
</script>
Expand Down
2 changes: 1 addition & 1 deletion 1-js/99-js-misc/01-proxy/01-error-nonexisting/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ function wrap(target) {
user = wrap(user);

alert(user.name); // John
alert(user.age); // ReferenceError: Property doesn't exist "age"
alert(user.age); // ReferenceError: Property doesn't exist: "age"
```
2 changes: 1 addition & 1 deletion 1-js/99-js-misc/01-proxy/01-error-nonexisting/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ user = wrap(user);

alert(user.name); // John
*!*
alert(user.age); // ReferenceError: Property doesn't exist "age"
alert(user.age); // ReferenceError: Property doesn't exist: "age"
*/!*
```
Loading