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
: Bitwise operators work with 32-bit integers at the lowest, bit-level: see the [docs](mdn:/JavaScript/Reference/Operators/Bitwise_Operators)when they are needed.
146
+
: Operator bitwise bekerja dengan integer 32-bit di bit-level paling kecil: lihat [docs](mdn:/JavaScript/Reference/Operators/Bitwise_Operators)ketika mereka dibutuhkan.
147
147
148
-
Conditional
149
-
: The only operator with three parameters: `cond ? resultA : resultB`. If`cond`is truthy, returns`resultA`, otherwise`resultB`.
148
+
Kondisional
149
+
: Satu-satunya operator dengan tiga parameter: `cond ? resultA : resultB`. Jika`cond` truthy, mengembalikan`resultA`, jika tidak`resultB`.
150
150
151
-
Logical operators
152
-
: Logical AND `&&`and OR `||`perform short-circuit evaluation and then return the value where it stopped. Logical NOT `!`converts the operand to boolean type and returns the inverse value.
151
+
Operator logika
152
+
: Logika AND `&&`dan OR `||`menyajikan evaluasi sirkuit-pendek dan mengembalikan nilai di mana ia berhenti. Logika NOT `!`mengkonversi operand ke tipe boolean dan mengembalikan nilai kebalikannya.
153
153
154
-
Comparisons
154
+
Pembandingan
155
155
: Equality check `==` for values of different types converts them to a number (except `null` and `undefined` that equal each other and nothing else), so these are equal:
156
156
157
157
```js run
@@ -172,9 +172,9 @@ Other operators
172
172
173
173
More in: <info:operators>, <info:comparison>, <info:logical-operators>.
174
174
175
-
## Loops
175
+
## Loop
176
176
177
-
-We covered 3 types of loops:
177
+
-Kita meliput 3 tipe loop:
178
178
179
179
```js
180
180
// 1
@@ -193,25 +193,25 @@ More in: <info:operators>, <info:comparison>, <info:logical-operators>.
193
193
}
194
194
```
195
195
196
-
-The variable declared in`for(let...)`loop is visible only inside the loop. But we can also omit`let`and reuse an existing variable.
197
-
-Directives`break/continue`allow to exit the whole loop/currentiteration. Use labels to break nested loops.
196
+
-Variabel yang dideklarasi di loop `for(let...)`terlihat cuma di dalam loop. Tapi kita juga bisa membuang`let`dan memakai kembali variabel yang sudah eksis.
197
+
-Directive`break/continue`membolehkan untuk keluar iterasi loop/current. Guakan label untuk menghancurkan loop bersarang.
198
198
199
-
Details in:<info:while-for>.
199
+
Detil di:<info:while-for>.
200
200
201
-
Later we'll study more types of loops to deal with objects.
201
+
Nanti kita akan pelajari tipe loop lainnya untuk berhadapan dengan object.
202
202
203
-
## The "switch" construct
203
+
## Konstruksi"switch"
204
204
205
-
The "switch" construct can replace multiple `if` checks. It uses `===` (strict equality) for comparisons.
205
+
Konstruksi"switch"bisa mengganti pengecekan ganda`if`. Ia memakai`===` (ekualitas ketat) untuk pembandingan.
206
206
207
-
For instance:
207
+
Misalnya:
208
208
209
209
```js run
210
210
let age = prompt('Your age?', 18);
211
211
212
212
switch (age) {
213
213
case 18:
214
-
alert("Won't work"); // the result of prompt is a string, not a number
214
+
alert("Won't work"); // hasil prompt ialah string, bukan angka
215
215
216
216
case "18":
217
217
alert("This works!");
@@ -222,13 +222,13 @@ switch (age) {
222
222
}
223
223
```
224
224
225
-
Details in: <info:switch>.
225
+
Detal di:<info:switch>.
226
226
227
-
## Functions
227
+
## Fungsi
228
228
229
-
We covered three ways to create a function in JavaScript:
229
+
Kita meliput tiga cara membuat fungsi di JavaScript:
230
230
231
-
1. Function Declaration: the function in the main code flow
231
+
1. Deklarasi Fungsi: fungsi di aliran kode utama
232
232
233
233
```js
234
234
function sum(a, b) {
@@ -238,7 +238,7 @@ We covered three ways to create a function in JavaScript:
238
238
}
239
239
```
240
240
241
-
2. Function Expression: the function in the context of an expression
241
+
2.Expresi Fungsi: fungsi di dalam kontex expresi
242
242
243
243
```js
244
244
let sum = function(a, b) {
@@ -248,32 +248,32 @@ We covered three ways to create a function in JavaScript:
248
248
};
249
249
```
250
250
251
-
3. Arrow functions:
251
+
3.Fungsi panah:
252
252
253
253
```js
254
-
// expression at the right side
254
+
// expresi di sisi kanan
255
255
let sum = (a, b) => a + b;
256
256
257
-
// or multi-line syntax with { ... }, need return here:
257
+
// atau syntax baris-ganda dengan { ... }, butuh kembalian di sini:
258
258
let sum = (a, b) => {
259
259
// ...
260
260
return a + b;
261
261
}
262
262
263
-
// without arguments
263
+
// tanpa argumen
264
264
let sayHi = () => alert("Hello");
265
265
266
-
// with a single argument
266
+
// dengan argumen tunggal
267
267
let double = n => n * 2;
268
268
```
269
269
270
270
271
-
- Functions may have local variables: those declared inside its body. Such variables are only visible inside the function.
272
-
- Parameters can have default values: `function sum(a = 1, b = 2) {...}`.
273
-
- Functions always return something. If there's no `return` statement, then the result is `undefined`.
271
+
-Fungsi bisa punya variabel lokal: mereka yang dideklarasi dalam badannya. Variabel macam itu cuma terlihat di dalam fungsi.
272
+
-Parameter bisa punya nilai default:`function sum(a = 1, b = 2) {...}`.
273
+
-Fungsi selalu mengembalikan sesuatu. Jika tak ada pernyataan `return`, maka kembaliannya`undefined`.
274
274
275
-
Details: see <info:function-basics>, <info:function-expressions-arrows>.
That was a brief list of JavaScript features. As of now we've studied only basics. Further in the tutorial you'll find more specials and advanced features of JavaScript.
279
+
Ini daftar ringkas fitur JavaScript. Untuk sekarang kita belajar hanya dasar. Kemudian di tutorial nanti kamu akan menemui fitur JavaScript yang lebih canggih dan spesial.
0 commit comments