You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: 1-js/01-getting-started/1-intro/article.md
+67
Original file line number
Diff line number
Diff line change
@@ -24,26 +24,44 @@ Browser punya engine yang tertanam didalamnya yang disebut "JavaScript virtual m
24
24
25
25
Tiap engine punya *codename*-nya sendiri. Misalnya:
26
26
27
+
<<<<<<< HEAD
27
28
-[V8](https://en.wikipedia.org/wiki/V8_(JavaScript_engine)) -- di Chrome dan Opera.
28
29
-[SpiderMonkey](https://en.wikipedia.org/wiki/SpiderMonkey) -- di Firefox.
29
30
- ...Ada juga codename lain seperti "Trident" dan "Chakra" untuk versi berbeda dari IE, "ChakraCore" untuk Microsoft Edge, "Nitro" dan "SquirrelFish" untuk Safari, dll.
30
31
31
32
Istilah di atas sebaiknya diingat karena akan sering digunakan dalam artikel para developer di internet. Kita akan menggunakannya juga. Misalnya, jika "fitur X didukung V8", kemungkinan ia bisa jalan di Chrome dan Opera.
33
+
=======
34
+
-[V8](https://en.wikipedia.org/wiki/V8_(JavaScript_engine)) -- in Chrome, Opera and Edge.
35
+
-[SpiderMonkey](https://en.wikipedia.org/wiki/SpiderMonkey) -- in Firefox.
36
+
- ...There are other codenames like "Chakra" for IE, "JavaScriptCore", "Nitro" and "SquirrelFish" for Safari, etc.
37
+
38
+
The terms above are good to remember because they are used in developer articles on the internet. We'll use them too. For instance, if "a feature X is supported by V8", then it probably works in Chrome, Opera and Edge.
39
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
32
40
33
41
```smart header="Bagaimana engine bekerja?"
34
42
35
43
Engine sangat rumit. Tapi basicnya mudah.
36
44
45
+
<<<<<<< HEAD
37
46
1. Engine (tertanam jika ia sebuah browser)bisa membaca ("memparsing") script.
38
47
2. Lalu ia mengkonversi ("mengkompilasi") script tersebut menjadi bahasa mesin.
39
48
3. Dan kemudian kode mesin berjalan, lumayan cepat.
49
+
=======
50
+
1. The engine (embedded if it's a browser) reads ("parses") the script.
51
+
2. Then it converts ("compiles") the script to machine code.
52
+
3. And then the machine code runs, pretty fast.
53
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
40
54
41
55
Engine melakukan optimisasi di setiap langkah proses. Dia bahkan memperhatikan script yang telah dikompilasi saat sedang berjalan, menganalisa data yang mengalir di dalam, dan melakukan optimisasi ke kode mesin berdasarkan pengetahuan itu.
42
56
```
43
57
44
58
## Apa yang bisa dilakukan *in-browser JavaScript*?
45
59
60
+
<<<<<<< HEAD
46
61
JavaScript modern merupakan bahasa pemrograman yang "aman". Ia tidak menyebabkan akses tingkat-rendah ke memory atau CPU, karena memang awalnya dibuat untuk browser, yang tentunya tidak membutuhkan hal tersebut.
62
+
=======
63
+
Modern JavaScript is a "safe" programming language. It does not provide low-level access to memory or the CPU, because it was initially created for browsers which do not require it.
64
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
47
65
48
66
Kemampuan JavaScript sangat tergantung pada lingkungan tempat ia berjalan. Misalnya, [Node.js](https://wikipedia.org/wiki/Node.js) mendukung function yang memungkingkan JavaScript melakukan baca/tulis file apapun, melakukan permintaan jaringan, dsb.
## Apa yang TIDAK BISA dilakukan *in-browser JavaScript*?
61
79
80
+
<<<<<<< HEAD
62
81
Kemampuan JavaScript yang ada di dalam browser terbatas demi keamanan pengguna. Tujuannya supaya mencegah halaman web berbahya mengakses informasi pribadi atau merusak data pengguna.
82
+
=======
83
+
JavaScript's abilities in the browser are limited to protect the user's safety. The aim is to prevent an evil webpage from accessing private information or harming the user's data.
84
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
63
85
64
86
Contoh keterbatasan tersebut meliputi:
65
87
66
88
- Javascript didalam sebuah halaman web seharusnya tidak dapat membaca/mengubah file didalam hardisk semaunya.
67
89
68
90
Browser-browser modern memperbolehkan JavaScript mengakses file, tapi aksesnya dibatasi dan tersedia hanya jika pengguna melakukan hal tertentu, misalnya seperti "menjatuhkan" file ke dalam jendela browser atau memilih file via tag `<input>`.
69
91
92
+
<<<<<<< HEAD
70
93
Ada beberapa cara untuk berinteraksi dengan kamera/mikrofon dan perangkat-perangkat lainnya, namun mereka butuh ijin khusus pengguna. Jadi sebuah halaman yang memiliki JavaScript tidak bisa mengaktifkan web-camera, memantau sekeliling dan mengirim informasinya ke [NSA] secara diam-diam(https://en.wikipedia.org/wiki/National_Security_Agency).
71
94
- Tab/jendela yang berbeda umumnya tidak ada hubungan sama sekali. Terkadang jendela yang berbeda bisa saling berhubungan juga, misalnya ketika satu jendela menggunakan JavaScript untuk membuka jendela lainnya. Tapi meski demikian, JavaScript dari suatu halaman tak boleh mengakses halaman lainnya jika mereka berasal dari situs yang berbeda (dari domain, protokol, atau port berbeda).
72
95
@@ -78,34 +101,62 @@ Contoh keterbatasan tersebut meliputi:
78
101

79
102
80
103
Pembatasan macam ini tidak ada jika JavaScript digunakan di luar browser, misalnya di server. Browser-browser modern juga memperbolehkan plugin/ekstensi yang membutuhkan ijin tambahan.
104
+
=======
105
+
There are ways to interact with the camera/microphone and other devices, but they require a user's explicit permission. So a JavaScript-enabled page may not sneakily enable a web-camera, observe the surroundings and send the information to the [NSA](https://en.wikipedia.org/wiki/National_Security_Agency).
106
+
- Different tabs/windows generally do not know about each other. Sometimes they do, for example when one window uses JavaScript to open the other one. But even in this case, JavaScript from one page may not access the other page if they come from different sites (from a different domain, protocol or port).
107
+
108
+
This is called the "Same Origin Policy". To work around that, *both pages* must agree for data exchange and must contain special JavaScript code that handles it. We'll cover that in the tutorial.
109
+
110
+
This limitation is, again, for the user's safety. A page from `http://anysite.com` which a user has opened must not be able to access another browser tab with the URL `http://gmail.com`, for example, and steal information from there.
111
+
- JavaScript can easily communicate over the net to the server where the current page came from. But its ability to receive data from other sites/domains is crippled. Though possible, it requires explicit agreement (expressed in HTTP headers) from the remote side. Once again, that's a safety limitation.
112
+
113
+

114
+
115
+
Such limitations do not exist if JavaScript is used outside of the browser, for example on a server. Modern browsers also allow plugins/extensions which may ask for extended permissions.
116
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
81
117
82
118
## Apa yang membuat JavaScript unik?
83
119
84
120
Paling tidak ada *tiga* hal unik dari JavaScript:
85
121
86
122
```compare
123
+
<<<<<<< HEAD
87
124
+ Integrasi penuh dengan HTML/CSS.
88
125
+ Hal sederhana diselesaikan dengan sederhana.
89
126
+ Dukungan dari mayoritas web browser dan aktif secara default.
127
+
=======
128
+
+ Full integration with HTML/CSS.
129
+
+ Simple things are done simply.
130
+
+ Supported by all major browsers and enabled by default.
131
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
90
132
```
91
133
JavaScript merupakan satu-satunya teknologi browser yang mengkombinasikan ketiga poin di atas.
92
134
93
135
Itulah yang membuat JavaScript unik. Itulah kenapa JavaScript menjadi alat yang paling sering untuk membuat antarmuka browser.
94
136
137
+
<<<<<<< HEAD
95
138
Katanya, JavaScript juga bisa dipakai untuk membuat aplikasi server, mobile, dsb.
139
+
=======
140
+
That said, JavaScript can be used to create servers, mobile applications, etc.
141
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
96
142
97
143
## Bahasa "di atas" JavaScript
98
144
99
145
Sintaks JavaScript tidak memenuhi kebutuhan setiap orang. Masing-masing orang ingin fitur yang berbeda-beda.
100
146
101
147
Itu wajar, karena proyek dan persyaratan tiap orang berbeda-beda.
102
148
149
+
<<<<<<< HEAD
103
150
Akhir-akhir ini muncul banyak bahasa baru, yang *ditranspile* (dikonversi) ke JavaScript sebelum dijalankan di browser.
151
+
=======
152
+
So, recently a plethora of new languages appeared, which are *transpiled* (converted) to JavaScript before they run in the browser.
153
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
104
154
105
155
Tools modern membuat transpilasi sangat cepat dan transparan, yang memungkinkan para developer menulis kodenya dalam bahasa lain dan mengautokonversi itu "di balik layar".
106
156
107
157
Contoh bahasa yang dimaksud:
108
158
159
+
<<<<<<< HEAD
109
160
-[CoffeeScript](http://coffeescript.org/) merupakan "syntactic sugar" dari JavaScript. Dia memperkenalkan syntax yang lebih pendek, memungkingkan kita menulis kode lebih bersih dan lebih presisi. Biasanya, Ruby devs menyukainya.
110
161
-[TypeScript](http://www.typescriptlang.org/) berfokus pada penambahan "strict data typing" yang menyederhanakan pengembangan dan dukungan sistem yang komplex. Ia dikembangkan oleh Microsoft.
111
162
-[Flow](http://flow.org/) juga menambahkan data typing, tapi dalam cara berbeda. Dikembangkan oleh Facebook.
@@ -114,9 +165,25 @@ Contoh bahasa yang dimaksud:
114
165
-[Kotlin](https://kotlinlang.org/docs/reference/js-overview.html) adalah sebuah bahasa pemograman modern, ringkas dan aman yang dapat ditargetkan untuk browser atau Node.
115
166
116
167
Masih banyak lagi. Tentunya, jika kita menggunakan salah satu bahasa yang ditranspile tersebut, kita sebaiknya juga paham JavaScript untuk mengerti apa yang mereka lakukan.
168
+
=======
169
+
-[CoffeeScript](https://coffeescript.org/) is "syntactic sugar" for JavaScript. It introduces shorter syntax, allowing us to write clearer and more precise code. Usually, Ruby devs like it.
170
+
-[TypeScript](https://www.typescriptlang.org/) is concentrated on adding "strict data typing" to simplify the development and support of complex systems. It is developed by Microsoft.
171
+
-[Flow](https://flow.org/) also adds data typing, but in a different way. Developed by Facebook.
172
+
-[Dart](https://www.dartlang.org/) is a standalone language that has its own engine that runs in non-browser environments (like mobile apps), but also can be transpiled to JavaScript. Developed by Google.
173
+
-[Brython](https://brython.info/) is a Python transpiler to JavaScript that enables the writing of applications in pure Python without JavaScript.
174
+
-[Kotlin](https://kotlinlang.org/docs/reference/js-overview.html) is a modern, concise and safe programming language that can target the browser or Node.
175
+
176
+
There are more. Of course, even if we use one of these transpiled languages, we should also know JavaScript to really understand what we're doing.
177
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
117
178
118
179
## Kesimpulan
119
180
181
+
<<<<<<< HEAD
120
182
- JavaScript awalnya diciptakan sebagai bahasa khusus browser, namun sekarang banyak digunakan di lingkungan lain.
121
183
- Sekarang, JavaScript mempunyai posisi unik sebagai bahasa browser paling banyak diadopsi dengan integrasi penuh dengan HTML/CSS.
122
184
- Ada banyak bahasa yang "ditranspile" ke JavaScript dan menyediakan fitur tertentu. Disarankan untuk mempelajari mereka juga, minimal sebentar, setelah menguasai JavaScript.
185
+
=======
186
+
- JavaScript was initially created as a browser-only language, but it is now used in many other environments as well.
187
+
- Today, JavaScript has a unique position as the most widely-adopted browser language, fully integrated with HTML/CSS.
188
+
- There are many languages that get "transpiled" to JavaScript and provide certain features. It is recommended to take a look at them, at least briefly, after mastering JavaScript.
Copy file name to clipboardexpand all lines: 1-js/01-getting-started/2-manuals-specifications/article.md
+21
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,23 @@
2
2
3
3
Buku ini adalah _tutorial_. Tujuannya membantu kamu memahami bahasa ini (Javascript) pelan-pelan. Tapi sekali kamu akrab atau familiar dengan dasarnya, kamu juga membutuhkan dari sumber-sumber lain.
4
4
5
+
<<<<<<< HEAD
5
6
## Spesifikasi
7
+
=======
8
+
This book is a *tutorial*. It aims to help you gradually learn the language. But once you're familiar with the basics, you'll need other resources.
9
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
6
10
7
11
[Spesifikasi ECMA-262](https://www.ecma-international.org/publications/standards/Ecma-262.htm) berisi informasi formal, detil, and mendalam tentang JavaScript. Ia mendefisikan bahasa ini.
8
12
9
13
Tapi karena menjadi formal, ia sulit dipahami di awal. Jadi jika kamu butuh sumber informasi terpercaya tentang detil bahasa, spesifikasi ini tempat yang tepat. Tapi ini bukan untuk penggunaan harian.
10
14
11
15
Versi spesifikasi baru dirilis tiap tahun. Di antara rilis ini, draft spesifikasi terakhir ada di <https://tc39.es/ecma262/>.
12
16
17
+
<<<<<<< HEAD
13
18
Untuk membaca tentang fitur terkini, termasuk yang "hampir menjadi standar" (disebut "stage 3"), lihat proposalnya di <https://github.com/tc39/proposals>.
19
+
=======
20
+
A new specification version is released every year. Between these releases, the latest specification draft is at <https://tc39.es/ecma262/>.
21
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
14
22
15
23
Juga, jika kamu dalam pengembangan untuk peramban, maka ada spek lain yang dibahas di [bagian kedua](info:browser-environment) di tutorial ini.
16
24
@@ -20,20 +28,33 @@ Juga, jika kamu dalam pengembangan untuk peramban, maka ada spek lain yang dibah
20
28
21
29
Kamu bisa cari di <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference>.
22
30
31
+
<<<<<<< HEAD
23
32
Meski, sering lebih bagus menggunakan pencarian internet. Pakai "MDN [term]" di query, misal <https://google.com/search?q=MDN+parseInt> untuk mencari fungsi `parseInt`.
24
33
25
34
-**MSDN** – Manual Microsoft dengan banyak informasi, termasuk JavaScript (sering dirujuk sebagai JScript). Jika kamu butuh sesuatu yang spesifik ke Internet Explorer, lebih baik pergi ke: <http://msdn.microsoft.com/>.
35
+
=======
36
+
You can find it at <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference>.
37
+
38
+
Although, it's often best to use an internet search instead. Just use "MDN [term]" in the query, e.g. <https://google.com/search?q=MDN+parseInt> to search for the `parseInt` function.
39
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
26
40
27
41
Juga, kamu bisa menggunakan pencarian internet dengan frasa seperti "RegExp MSDN" atau "RegExp MSDN jscript".
28
42
29
43
## Tabel kompatibilitas
30
44
31
45
JavaScript merupakan bahasa berkembang, fitur baru ditambah secara reguler.
32
46
47
+
<<<<<<< HEAD
33
48
Untuk melihat dukungan mereka pada engine berbasis peramban dan lainnya, lihat:
34
49
35
50
-<http://caniuse.com> - tabel dukungan per-fitur, misal untuk melihat engine mana yang mendukung fungsi kryptografi modern: <http://caniuse.com/#feat=cryptography>.
36
51
-<https://kangax.github.io/compat-table> - tabel dengan fitur dan engine bahasa yang mendukung atau yang tidak mendukung.
52
+
=======
53
+
-<https://caniuse.com> - per-feature tables of support, e.g. to see which engines support modern cryptography functions: <https://caniuse.com/#feat=cryptography>.
54
+
-<https://kangax.github.io/compat-table> - a table with language features and engines that support those or don't support.
55
+
56
+
All these resources are useful in real-life development, as they contain valuable information about language details, their support, etc.
57
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
37
58
38
59
Semua sumber ini berguna di pengembangan nyata, karena mereka berisi informasi berharga tentang detil bahasa, dukungan mereka dll.
Untuk Windows, ada juga "Visual Studio", jangan dipusingkan dengan "Visual Studio Code." "Visual Studio" merupakan editor khusus Windows yang keren dan berbayar, sangat cocok untuk platform .NET. Ia bagus juga untuk JavaScript. Lalu ada juga versi gratisnya [Visual Studio Community](https://www.visualstudio.com/vs/community/).
19
24
@@ -29,18 +34,35 @@ Perbedaan utama antara "editor ringan" dan "IDE" adalah IDE bekerja pada level p
29
34
30
35
Pada praktiknya, editor ringan bisa punya banyak plugin termasuk syntax analyzers dan autocompleters level direktori, jadi tak ada batasan ketat antara editor ringan dan IDE.
-[Vim](https://www.vim.org/) and [Emacs](https://www.gnu.org/software/emacs/) are also cool if you know how to use them.
51
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
39
52
40
53
## Jangan berdebat
41
54
42
55
Daftar editor di atas merupakan barang yang sudah biasa saya atau teman-teman saya para pengembang profesional gunakan selama ini dengan gembira.
43
56
44
57
Ada banyak editor bagus lainnya di dunia kita yang besar ini. Silakan pilih satu yang paling kamu suka.
45
58
59
+
<<<<<<< HEAD
46
60
Pilihan editor, sama seperti tool lainnya, bersifat individual dan tergantung pada proyek, kebiasaan, dan preferensi personal.
61
+
=======
62
+
The choice of an editor, like any other tool, is individual and depends on your projects, habits, and personal preferences.
63
+
64
+
The author's personal opinion:
65
+
66
+
- I'd use [Visual Studio Code](https://code.visualstudio.com/) if I develop mostly frontend.
67
+
- Otherwise, if it's mostly another language/platform and partially frontend, then consider other editors, such as XCode (Mac), Visual Studio (Windows) or Jetbrains family (Webstorm, PHPStorm, RubyMine etc, depending on the language).
Copy file name to clipboardexpand all lines: 1-js/02-first-steps/01-hello-world/article.md
+4
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,11 @@ File script ditempel ke HTML dengan atribut `src`:
73
73
<scriptsrc="/path/to/script.js"></script>
74
74
```
75
75
76
+
<<<<<<< HEAD
76
77
Di sini, `/path/to/script.js` adalah jalur absolut ke file script dari root sitius. Kamu juga bisa menyediakan jalur relatif dari laman ini. Misalnya, `src="script.js"` berarti file `"script.js"` dalam folder saat ini.
78
+
=======
79
+
Here, `/path/to/script.js` is an absolute path to the script from the site root. One can also provide a relative path from the current page. For instance, `src="script.js"`, just like `src="./script.js"`, would mean a file `"script.js"` in the current folder.
Di sini kita punya konstan tanggal `birthday` dan `age` dikalkulasi dari `birthday` dengan batuan beberapa kode (tidak tersedia yang pendek-pendek, dan karena detail tidak masalah di sini).
17
+
=======
18
+
Here we have a constant `birthday` for the date, and also the `age` constant.
19
+
20
+
The `age` is calculated from `birthday` using `someCode()`, which means a function call that we didn't explain yet (we will soon!), but the details don't matter here, the point is that `age` is calculated somehow based on the `birthday`.
21
+
>>>>>>> 3d7abb9cc8fa553963025547717f06f126c449b6
16
22
17
23
Apakah tepat menggunakan huruf kapital untuk `birthday`? Untuk `age`? Atau bahkan untuk keduanya?
18
24
19
25
```js
26
+
<<<<<<<HEAD
20
27
constBIRTHDAY='18.04.1982'; // buat huruf kapital?
21
28
22
29
constAGE=someCode(BIRTHDAY); // buat huruf kapital?
23
-
```
30
+
=======
31
+
constBIRTHDAY='18.04.1982'; // make birthday uppercase?
24
32
33
+
constAGE=someCode(BIRTHDAY); // make age uppercase?
0 commit comments