Skip to content

Commit d2d27da

Browse files
committed
chore(i18n): 1.02.05 done
1 parent 47afa87 commit d2d27da

File tree

1 file changed

+79
-79
lines changed

1 file changed

+79
-79
lines changed

1-js/02-first-steps/05-types/article.md

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -12,57 +12,57 @@ Bahasa pemrograman yang memperbolehkan hal semacam ini dibsebut "dynamically typ
1212

1313
Ada tujuh tipe data dasar di JavaScript. Di sini, kita akan mengcover mereka secara umum dan di bab berikutnya kita akan berbicara tentang setiap dari mereka secara detil.
1414

15-
## Angka
15+
## Number
1616

1717
```js
1818
let n = 123;
1919
n = 12.345;
2020
```
2121

22-
Tipe *angka* merepresentasikan baik angka integer maupun floating point.
22+
Tipe *number* merepresentasikan angka baik integer maupun floating point.
2323

2424
Ada banyak operasi untuk angka, misal perkalian `*`, pembagian `/`, penambahan `+`, pengurangan `-`, dan lainnya.
2525

26-
Besides regular numbers, there are so-called "special numeric values" which also belong to this data type: `Infinity`, `-Infinity` and `NaN`.
26+
Selain angka reguler, ada yang disebut "nilai numerik spesial" yang juga bagian dari tipe data ini: `Infinity`, `-Infinity` dan `NaN`.
2727

28-
- `Infinity` represents the mathematical [Infinity](https://en.wikipedia.org/wiki/Infinity) ∞. It is a special value that's greater than any number.
28+
- `Infinity` mewakili [Infinity](https://en.wikipedia.org/wiki/Infinity) matematis ∞. Ia merupakan nilai spesial yang lebih besar dari angka apapun.
2929

30-
We can get it as a result of division by zero:
30+
Kita bisa mendapatkannya sebagai hasil dari pembagian oleh nol:
3131

3232
```js run
3333
alert( 1 / 0 ); // Infinity
3434
```
3535

36-
Or just reference it directly:
36+
Atau langsung referensikan saja dia:
3737

3838
```js run
3939
alert( Infinity ); // Infinity
4040
```
41-
- `NaN` represents a computational error. It is a result of an incorrect or an undefined mathematical operation, for instance:
41+
- `NaN` mewakili error komputasional. Ia merupakan hasil operasi matematis yang salah atau tak-terdefinisi, misalnya:
4242

4343
```js run
44-
alert( "not a number" / 2 ); // NaN, such division is erroneous
44+
alert( "not a number" / 2 ); // NaN, pembagian macam ini keliru
4545
```
4646

47-
`NaN` is sticky. Any further operation on `NaN` returns `NaN`:
47+
`NaN` itu lengket. Operasi lanjutan apapun pada `NaN` menghasilkan `NaN`:
4848

4949
```js run
5050
alert( "not a number" / 2 + 5 ); // NaN
5151
```
5252

53-
So, if there's a `NaN` somewhere in a mathematical expression, it propagates to the whole result.
53+
Jadi, jika ada `NaN` di manapun di expresi matematika, ia mempropagasi hasil keseluruhan.
5454

55-
```smart header="Mathematical operations are safe"
56-
Doing maths is "safe" in JavaScript. We can do anything: divide by zero, treat non-numeric strings as numbers, etc.
55+
```smart header="Operasi matematika itu aman"
56+
Melakukan matematika itu "aman" dalam JavaScript. Kita bisa melakukan apapun: pembagian dengan nol, memperlakukan string non-numerik sebagai angka, dll.
5757
58-
The script will never stop with a fatal error ("die"). At worst, we'll get `NaN` as the result.
58+
Script ini takkan pernah stop dengan fatal error ("die"). Paling buruk, kita akan mendapat `NaN` sebagai hasilnya.
5959
```
6060

61-
Special numeric values formally belong to the "number" type. Of course they are not numbers in the common sense of this word.
61+
Nilai numerik spesial formalnya merupakan bagian dari tipe "number". Tentu saja mereka bukan angka dalam pandangan umum dari kata ini.
6262

63-
We'll see more about working with numbers in the chapter <info:number>.
63+
Kita akan melihat lebih tentang cara bekerja dengan angka di bab <info:number>.
6464

65-
## A string
65+
## String
6666

6767
String di JavaScript harus dikelilingi petik.
6868

@@ -78,89 +78,89 @@ Di JavaScript, ada 3 tipe petik.
7878
2. Petik tunggal: `'Hello'`.
7979
3. Backtick: <code>&#96;Hello&#96;</code>.
8080

81-
Double and single quotes are "simple" quotes. There's no difference between them in JavaScript.
81+
Petik tunggal dan ganda merupakan petik "simpel". Tak ada perbedaan antara mereka di JavaScript.
8282

83-
Backticks are "extended functionality" quotes. They allow us to embed variables and expressions into a string by wrapping them in `${…}`, for example:
83+
Backtick merupakan petik "fungsional lanjutan". Mereka memungkinkan kita mengembed variabel dan expresi ke dalam string dengan membungkus mereka dalam `${}`, misalnya:
8484

8585
```js run
8686
let name = "John";
8787
88-
// embed a variable
88+
// mengembed satu variabel
8989
alert( `Hello, *!*${name}*/!*!` ); // Hello, John!
9090

91-
// embed an expression
92-
alert( `the result is *!*${1 + 2}*/!*` ); // the result is 3
91+
// mengembed expresi
92+
alert( `the result is *!*${1 + 2}*/!*` ); // hasilnya 3
9393
```
9494

95-
The expression inside `${…}` is evaluated and the result becomes a part of the string. We can put anything in there: a variable like `name` or an arithmetical expression like `1 + 2` or something more complex.
95+
Expresi di dalam `${…}` dievaluasi dan hasilnya menjadi bagian dari string. Kita bisa menaruh apapun di sana: variabel seperti `name` atau expresi aritmatika seperti `1 + 2` atau sesuatu yang lebih rumit.
9696

97-
Please note that this can only be done in backticks. Other quotes don't have this embedding functionality!
97+
Tolong diingat bahwa ini hanya bisa dilakukan dalam backtick. Petik lain tidak punya fungsionalitas pengembedan!
9898
```js run
99-
alert( "the result is ${1 + 2}" ); // the result is ${1 + 2} (double quotes do nothing)
99+
alert( "the result is ${1 + 2}" ); // hasilnya ${1 + 2} (petik ganda tak akan berpengaruh)
100100
```
101101

102-
We'll cover strings more thoroughly in the chapter <info:string>.
102+
Kita akan mengcover string lebih dalam di bab <info:string>.
103103

104-
```smart header="There is no *character* type."
105-
In some languages, there is a special "character" type for a single character. For example, in the C language and in Java it is `char`.
104+
```smart header="Tidak ada tipe *character*."
105+
Dalam beberapa bahasa, ada tipe "character" spesial untuk karakter tunggal. Misalnya, di bahasa C dan di Java adalah `char`.
106106
107-
In JavaScript, there is no such type. There's only one type: `string`. A string may consist of only one character or many of them.
107+
Di JavaScript, tak ada tipe semacam itu. Cuma ada satu tipe: `string`. String bisa berisi satu karakter atau lebih.
108108
```
109109

110-
## A boolean (logical type)
110+
## Boolean (tipe logika)
111111

112-
The boolean type has only two values: `true` and `false`.
112+
Tipe boolean cuma punya dua nilai: `true` dan `false`.
113113

114-
This type is commonly used to store yes/no values: `true` means "yes, correct", and `false` means "no, incorrect".
114+
Tipe ini umumnya digunakan untuk menyimpan niai ya/tidak: `true` artinya "ya, betul", dan `false` artinya "tidak, salah".
115115

116-
For instance:
116+
Misalnya:
117117

118118
```js
119-
let nameFieldChecked = true; // yes, name field is checked
120-
let ageFieldChecked = false; // no, age field is not checked
119+
let nameFieldChecked = true; // ya, field nama dicek
120+
let ageFieldChecked = false; // tidak, field usia tak dicek
121121
```
122122

123-
Boolean values also come as a result of comparisons:
123+
Nilai boolean juga datang dari perbandingan:
124124

125125
```js run
126126
let isGreater = 4 > 1;
127127

128-
alert( isGreater ); // true (the comparison result is "yes")
128+
alert( isGreater ); // benar (hasil perbandingan yaitu "ya")
129129
```
130130

131-
We'll cover booleans more deeply in the chapter <info:logical-operators>.
131+
Kita akan mengcover boolean lebih dalam di bab <info:logical-operators>.
132132

133-
## The "null" value
133+
## Nilai "null"
134134

135-
The special `null` value does not belong to any of the types described above.
135+
Nilai `null` spesial bukan bagian dari tipe apapun yang dijelaskan di atas.
136136

137-
It forms a separate type of its own which contains only the `null` value:
137+
Ia membentuk tipe terpisah miliknya sendiri yang cuma berisi nilai `null`:
138138

139139
```js
140140
let age = null;
141141
```
142142

143-
In JavaScript, `null` is not a "reference to a non-existing object" or a "null pointer" like in some other languages.
143+
Di JavaScript, `null` tidak "mereferensi ke objek yang tak ada" atau "null pointer" seperti beberapa bahasa lain.
144144

145-
It's just a special value which represents "nothing", "empty" or "value unknown".
145+
Ia cuma nilai spesial yang mewakili "hampa", "kosong" atau "nilai tak-diketahui".
146146

147-
The code above states that `age` is unknown or empty for some reason.
147+
Kode di atas menyatakan bahwa `age` tak diketahui atau kosong untuk beberapa alasan.
148148

149-
## The "undefined" value
149+
## Nilai "undefined"
150150

151-
The special value `undefined` also stands apart. It makes a type of its own, just like `null`.
151+
Nilai spesial `undefined` juga berbeda lagi. Ia punya tipe miliknya sendiri, sama seperti `null`.
152152

153-
The meaning of `undefined` is "value is not assigned".
153+
Arti `undefined` ialah "nilai yang tak diassign".
154154

155-
If a variable is declared, but not assigned, then its value is `undefined`:
155+
Jika variabel dideklarasi, namun tak diassign, maka nilainya `undefined`:
156156

157157
```js run
158158
let x;
159159

160-
alert(x); // shows "undefined"
160+
alert(x); // menampilkan "undefined"
161161
```
162162

163-
Technically, it is possible to assign `undefined` to any variable:
163+
Secara teknis, mungkin saja mengassign `undefined` ke variabel apapun:
164164

165165
```js run
166166
let x = 123;
@@ -170,28 +170,28 @@ x = undefined;
170170
alert(x); // "undefined"
171171
```
172172

173-
...But we don't recommend doing that. Normally, we use `null` to assign an "empty" or "unknown" value to a variable, and we use `undefined` for checks like seeing if a variable has been assigned.
173+
...Tapi kita tidak menyarankan itu. Normalnya, kita gunakan `null` untuk mengassign nilai "kosong" atau "tak-diketahui" ke variabel, dan kita gunakan `undefined` untuk pengecekan seperti melihat apakah variabel telah diassign.
174174

175-
## Objects and Symbols
175+
## Objek dan Simbol
176176

177-
The `object` type is special.
177+
Tipe `object` itu special.
178178

179-
All other types are called "primitive" because their values can contain only a single thing (be it a string or a number or whatever). In contrast, objects are used to store collections of data and more complex entities. We'll deal with them later in the chapter <info:object> after we learn more about primitives.
179+
Semua tipe lain disebut "primitive" karena nilainya bisa mengandung sesuatu yang tunggal (bisa jadi string atau angka atau apapun). Sebaliknya, objek digunakan untuk menyimpan koleksi data dan entitas lebih rumit. Kita akan berhadapan dengannya nanti di bab <info:object> setelah kita belajar tentang primitive.
180180

181-
The `symbol` type is used to create unique identifiers for objects. We have to mention it here for completeness, but it's better to study this type after objects.
181+
Tipe `symbol` digunakan untuk membuat identifier unik untuk objek. Kita harus menyebutkannya demi kelengkapan, tapi lebih baik untuk belajar tipe ini setelah objek.
182182

183-
## The typeof operator [#type-typeof]
183+
## Operator typeof [#type-typeof]
184184

185-
The `typeof` operator returns the type of the argument. It's useful when we want to process values of different types differently or just want to do a quick check.
185+
Operator `typeof` mengembalikan tipe argumen. Berguna ketika kita ingin memproses nilai dari tipe berbeda secara berbeda atau cuma ingin mengecek sekilas.
186186

187-
It supports two forms of syntax:
187+
Ia mendukung dua bentuk syntax:
188188

189-
1. As an operator: `typeof x`.
190-
2. As a function: `typeof(x)`.
189+
1. Sebagai operator: `typeof x`.
190+
2. Sebagai fungsi: `typeof(x)`.
191191

192-
In other words, it works with parentheses or without them. The result is the same.
192+
Dengan kata lain, ia berjalan dengan atau tanpa kurung. Hasilnya sama saja.
193193

194-
The call to `typeof x` returns a string with the type name:
194+
Panggilan ke `typeof x` mengembalikan string dengan nama tipenya:
195195

196196
```js
197197
typeof undefined // "undefined"
@@ -217,29 +217,29 @@ typeof alert // "function" (3)
217217
*/!*
218218
```
219219

220-
The last three lines may need additional explanation:
220+
Tiga baris terakhir mungkin butuh penjelasan tambahan:
221221

222-
1. `Math` is a built-in object that provides mathematical operations. We will learn it in the chapter <info:number>. Here, it serves just as an example of an object.
223-
2. The result of `typeof null` is `"object"`. That's wrong. It is an officially recognized error in `typeof`, kept for compatibility. Of course, `null` is not an object. It is a special value with a separate type of its own. So, again, this is an error in the language.
224-
3. The result of `typeof alert` is `"function"`, because `alert` is a function of the language. We'll study functions in the next chapters where we'll see that there's no special "function" type in JavaScript. Functions belong to the object type. But `typeof` treats them differently. Formally, it's incorrect, but very convenient in practice.
222+
1. `Math` ialah objek built-in yang menyediakan operasi matematik. Kita akan belajar itu di bab <info:number>. Di sini, itu cuma sekedar contoh dari objek.
223+
2. Hasil `typeof null` yaitu `"object"`. Itu salah. Ini merupakan error yang terkenal resmi dalam `typeof`, yang dijaga untuk kompatibilitas. Tentu saja, `null` bukanlah objek. Ia merupakan nilai spesial dengan tipe terpisah miliknya sendiri. Jadi, lagi, ini merupakan error dalam bahasa.
224+
3. Hasil dari `typeof alert` yaitu `"function"`, karena `alert` merupakan fungsi dari bahasa. Kita akan belajar fungsi di bab berikutnya di mana kita akan melihat bahwa tak ada tipe "function" spesial di JavaScript. Fungsi merupakan bagian dari tipe objek. Tapi `typeof` memperlakukan mereka secara berbeda. Formalnya, itu salah, tapi sangat nyaman pada praktiknya.
225225

226226

227-
## Summary
227+
## Kesimpulan
228228

229-
There are 7 basic data types in JavaScript.
229+
Ada 7 tipe data dasar dalam JavaScript.
230230

231-
- `number` for numbers of any kind: integer or floating-point.
232-
- `string` for strings. A string may have one or more characters, there's no separate single-character type.
233-
- `boolean` for `true`/`false`.
234-
- `null` for unknown values -- a standalone type that has a single value `null`.
235-
- `undefined` for unassigned values -- a standalone type that has a single value `undefined`.
236-
- `object` for more complex data structures.
237-
- `symbol` for unique identifiers.
231+
- `number` untuk angka jenis manapun: integer atau floating-point.
232+
- `string` untuk string. String mungkin punya satu atau lebih karakter, tak ada tipe katakter tunggal terpisah.
233+
- `boolean` untuk `true`/`false`.
234+
- `null` untuk nilai tak-diketahui -- tipe mandiri yang punya nilai tunggal `null`.
235+
- `undefined` untuk nilai tak-diassign -- tipe mandiri yang punya nilai tunggal `undefined`.
236+
- `object` untuk struktur data lebih rumit.
237+
- `symbol` untuk identifier unik.
238238

239-
The `typeof` operator allows us to see which type is stored in a variable.
239+
Operator `typeof` memungkinkan kita melihat tipe mana yang disimpan dalam variable.
240240

241-
- Two forms: `typeof x` or `typeof(x)`.
242-
- Returns a string with the name of the type, like `"string"`.
243-
- For `null` returns `"object"` -- this is an error in the language, it's not actually an object.
241+
- Dua form: `typeof x` atau `typeof(x)`.
242+
- Mengembalikan string dengan nama tipe, seperti `"string"`.
243+
- Untuk `null` mengembalikan `"object"` -- ada error dalam bahasa, yang sebenarnya bukan objek.
244244

245-
In the next chapters, we'll concentrate on primitive values and once we're familiar with them, we'll move on to objects.
245+
Di bab berikutnya, kita akan fokus pada nilai primitive dan sekali kita familiar dengan mereka, kita akan lanjut ke objek.

0 commit comments

Comments
 (0)