Skip to content

Commit c9ee44b

Browse files
committed
fix(i18n): 1.02.07
1 parent 0e2fe7a commit c9ee44b

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

1-js/02-first-steps/07-operators/article.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ Apakah ada perbedaan? Ya, tapi kita cuma bisa melihatnya jika kita menggunakan n
280280
281281
Mari kita klarifikasi. Seperti yang kita tahu, semua operator mengembalikan nilai. Inkremen/dekremen bukan pengecualian. Bentuk prefix mengembalikan nilai baru sedangkan bentuk postfix mengembalikan nilai lama (sebelum inkremen/dekremen).
282282
283-
Untuk melihat perbedaannya, berikut contohnya:
283+
Untuk melihat perbedaannya, berikut misalnya:
284284
285285
```js run
286286
let counter = 1;
@@ -305,7 +305,7 @@ Dalam barus `(*)`, bentuk *postfix* `counter++` juga menginkremen `counter` tapi
305305

306306
Ringkasnya:
307307

308-
- Jika hasil dari inkremen/dekremen tidak digunakan, tak ada perbedaan bentuk mana yang dipakai:
308+
- Jika hasil dari inkremen/dekremen tak digunakan, tak ada bedanya bentuk mana yang dipakai:
309309

310310
```js run
311311
let counter = 0;
@@ -319,33 +319,33 @@ Ringkasnya:
319319
let counter = 0;
320320
alert( ++counter ); // 1
321321
```
322-
- If we'd like to increment a value but use its previous value, we need the postfix form:
322+
- Jika kita ingin menginkremen suatu nilai tanpa memakai nilai sebelumnya, kita butuh bentuk postfix:
323323

324324
```js run
325325
let counter = 0;
326326
alert( counter++ ); // 0
327327
```
328328

329-
````smart header="Increment/decrement among other operators"
330-
The operators `++/--` can be used inside expressions as well. Their precedence is higher than most other arithmetical operations.
329+
````smart header="Inkremen/dekremen di antara operator lainnya"
330+
Operator `++/--` bisa juga digunakan di dalam expresi. Presedensi mereka lebih tinggi dari kebanyakan operasi aritmatika lainnya.
331331

332-
For instance:
332+
Misalnya:
333333

334334
```js run
335335
let counter = 1;
336336
alert( 2 * ++counter ); // 4
337337
```
338338

339-
Compare with:
339+
Bandingkan dengan:
340340

341341
```js run
342342
let counter = 1;
343-
alert( 2 * counter++ ); // 2, because counter++ returns the "old" value
343+
alert( 2 * counter++ ); // 2, karena counter++ mengembalikan nilai "lama"
344344
```
345345

346-
Though technically okay, such notation usually makes code less readable. One line does multiple things -- not good.
346+
Meski secara teknis OK, notasi macam ini biasanya membuat kode kurang dapat dibaca. Satu baris melakukan banyak hal -- tak baik.
347347

348-
While reading code, a fast "vertical" eye-scan can easily miss something like `counter++` and it won't be obvious that the variable increased.
348+
Sambil membaca kode, a fast "vertical" eye-scan can easily miss something like `counter++` and it won't be obvious that the variable increased.
349349
350350
We advise a style of "one line -- one action":
351351
@@ -356,13 +356,13 @@ counter++;
356356
​```
357357
````
358358
359-
## Bitwise operators
359+
## Operator bitwise
360360
361-
Bitwise operators treat arguments as 32-bit integer numbers and work on the level of their binary representation.
361+
Operator bitwise memperlakukan argumen sebagai angka integer 32-bit dan bekerja pada level representasi biner mereka.
362362
363-
These operators are not JavaScript-specific. They are supported in most programming languages.
363+
Operator ini bukan spesifik JavaScript. Mereka didukung di banyak bahasa pemrograman.
364364
365-
The list of operators:
365+
Daftar operator:
366366
367367
- AND ( `&` )
368368
- OR ( `|` )
@@ -372,77 +372,77 @@ The list of operators:
372372
- RIGHT SHIFT ( `>>` )
373373
- ZERO-FILL RIGHT SHIFT ( `>>>` )
374374
375-
These operators are used very rarely. To understand them, we need to delve into low-level number representation and it would not be optimal to do that right now, especially since we won't need them any time soon. If you're curious, you can read the [Bitwise Operators](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators) article on MDN. It would be more practical to do that when a real need arises.
375+
Operator ini sangat jarang digunakan. Untuk memahami mereka, kita harus menyelidiki lebih dalam representasi angka level-rendah dan itu tak akan optimal untuk dilakukan sekarang, terutama karena kita tak butuh mereka sesegera ini. Kalau kamu penasaran, kamu bisa baca artikel [Operator Bitwise](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators) di MDN. Itu akan lebih praktis untuk dilakukan ketika ada kebutuhan riil.
376376
377-
## Modify-in-place
377+
## Modifikasi di tempat
378378
379-
We often need to apply an operator to a variable and store the new result in that same variable.
379+
Kita sering wajib mengaplikasikan operator ke variabel dan menyimpan hasilnya di variabel yang sama.
380380
381-
For example:
381+
Misalnya:
382382
383383
​```js
384384
let n = 2;
385385
n = n + 5;
386386
n = n * 2;
387387
```
388388
389-
This notation can be shortened using the operators `+=` and `*=`:
389+
Notasi ini bisa dipersingkat menggunakan operator `+=` and `*=`:
390390
391391
```js run
392392
let n = 2;
393-
n += 5; // now n = 7 (same as n = n + 5)
394-
n *= 2; // now n = 14 (same as n = n * 2)
393+
n += 5; // sekarang n = 7 (sama dengan n = n + 5)
394+
n *= 2; // sekarang n = 14 (sama dengan n = n * 2)
395395
396396
alert( n ); // 14
397397
```
398398
399-
Short "modify-and-assign" operators exist for all arithmetical and bitwise operators: `/=`, `-=`, etc.
399+
Operator pendek "modifikasi-dan-tetapkan" eksis untuk semua operator arimatika dan bitwise: `/=`, `-=`, dll.
400400
401-
Such operators have the same precedence as a normal assignment, so they run after most other calculations:
401+
Operator macam ini punya presedensi yang sama dengan penetapan normal, jadi mereka berjalan setelah kebanyakan kalkulasi lain:
402402
403403
```js run
404404
let n = 2;
405405
406406
n *= 3 + 5;
407407
408-
alert( n ); // 16 (right part evaluated first, same as n *= 8)
408+
alert( n ); // 16 (bagian kanan dievaluasi lebih dulu, sama dengan n *= 8)
409409
```
410410
411-
## Comma
411+
## Koma
412412
413-
The comma operator `,` is one of the rarest and most unusual operators. Sometimes, it's used to write shorter code, so we need to know it in order to understand what's going on.
413+
Operator koma `,` ialah satu dari banyak operator paling langka dan tak biasa. Kadang, ia digunakan untuk menulis kode lebih pendek, jadi kita harus tahu itu untuk memahami apa yang terjadi.
414414
415-
The comma operator allows us to evaluate several expressions, dividing them with a comma `,`. Each of them is evaluated but only the result of the last one is returned.
415+
Operator koma memperbolehkan untuk mengevaluasi beberapa expresi, membagi mereka dengan koma `,`. Each of them is evaluated but only the result of the last one is returned.
416416
417-
For example:
417+
Misalnya:
418418
419419
```js run
420420
*!*
421421
let a = (1 + 2, 3 + 4);
422422
*/!*
423423
424-
alert( a ); // 7 (the result of 3 + 4)
424+
alert( a ); // 7 (hasil dari 3 + 4)
425425
```
426426
427-
Here, the first expression `1 + 2` is evaluated and its result is thrown away. Then, `3 + 4` is evaluated and returned as the result.
427+
Di sini, expresi pertama `1 + 2` dievaluasi dan hasilnya dibuang. Lalu, `3 + 4` dievaluasi dan dikembalikan sebagai hasilnya.
428428
429-
```smart header="Comma has a very low precedence"
430-
Please note that the comma operator has very low precedence, lower than `=`, so parentheses are important in the example above.
429+
```smart header="Koma punya presedensi sangat kecil"
430+
Harap ingat bahwa operator koma punya presedensi sangat kecil, lebih kecil dari `=`, jadi tanda kurung penting dalam contoh di atas.
431431
432-
Without them: `a = 1 + 2, 3 + 4` evaluates `+` first, summing the numbers into `a = 3, 7`, then the assignment operator `=` assigns `a = 3`, and finally the number after the comma, `7`, is not processed so it's ignored.
432+
Tanpa mereka: `a = 1 + 2, 3 + 4` mengevaluasi `+` terlebih dahulu, penjumlahan tersebut menjadi `a = 3, 7`, lalu operator penetapan `=` menetapkan `a = 3`, dan pada akhirnya angka setelah koma, `7`, tak diproses sehingga ia diabaikan.
433433
```
434434
435-
Why do we need an operator that throws away everything except the last part?
435+
Kenapa kita butuh operator yang membuang semuanya kecuali bagian akhirnya?
436436
437-
Sometimes, people use it in more complex constructs to put several actions in one line.
437+
Kadang, orang memakai itu dalam konstruksi rumit untuk menaruh beberapa aksi dalam satu baris.
438438
439-
For example:
439+
Misalnya:
440440
441441
```js
442-
// three operations in one line
442+
// tiga operasi dalam satu baris
443443
for (*!*a = 1, b = 3, c = a * b*/!*; a < 10; a++) {
444444
...
445445
}
446446
```
447447
448-
Such tricks are used in many JavaScript frameworks. That's why we're mentioning them. But, usually, they don't improve code readability so we should think well before using them.
448+
Trik macam ini dipakai di banyak framework JavaScript. Itulah kenapa kita membahas mereka. Tapi, biasanya, mereka tak meningkatkan keterbacaan kode sehingga kita sebaiknya pikir-pikir dulu sebelum menggunakan mereka.

0 commit comments

Comments
 (0)