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/02-first-steps/09-alert-prompt-confirm/article.md
+5-25Lines changed: 5 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,23 +30,15 @@ Fungsi `prompt` menerima dua argumen:
30
30
result =prompt(title, [default]);
31
31
```
32
32
33
-
<<<<<<< HEAD
34
33
Ia menampilkan modal window dengan pesan teks, input field untuk pengunjung, dan tombol OK/CANCEL.
35
-
=======
36
-
It shows a modal window with a text message, an input field for the visitor, and the buttons OK/Cancel.
37
-
>>>>>>> 8c30654f694fe8682f5631809980be931ee4ed72
38
34
39
35
`title`
40
36
: Teks untuk ditampilkan ke pengunjung.
41
37
42
38
`default`
43
39
: Parameter kedua opsional, nilai inisial untuk input field.
44
40
45
-
<<<<<<< HEAD
46
-
Pengunjung boleh menulis apapun di input field prompt dan menekan OK. Atau mereka bisa membatalkan input dengan menekan CANCEL atau menekan `key:Esc`.
47
-
=======
48
-
The visitor may type something in the prompt input field and press OK. Or they can cancel the input by pressing Cancel or hitting the `key:Esc` key.
49
-
>>>>>>> 8c30654f694fe8682f5631809980be931ee4ed72
41
+
Pengunjung boleh menulis apapun di input field prompt dan menekan OK. Atau mereka bisa membatalkan input dengan menekan Cancel atau menekan tombol `key:Esc`.
50
42
51
43
Panggilan ke `prompt` mengembalikan teks dari input field atau `null` jika input dibatalkan.
52
44
@@ -58,7 +50,7 @@ let age = prompt('How old are you?', 100);
58
50
alert(`You are ${age} years old!`); // You are 100 years old!
59
51
```
60
52
61
-
````warn header="In IE: always supply a `default`"
53
+
```warn header="In IE: always supply a `default`"
62
54
Parameter kedua ini opsional, tapi jika kita tidak menyuplai, Internet Explorer akan menyisipkan teks `"undefined"` ke dalam prompt.
63
55
64
56
Jalan kode ini di Internet Explorer untuk melihat:
@@ -72,7 +64,6 @@ Jadi, supaya prompt terlihat bagus di IE, sebaiknya sediakan argumen kedua:
72
64
```js run
73
65
let test =prompt("Test", ''); // <-- for IE
74
66
```
75
-
````
76
67
77
68
## confirm
78
69
@@ -82,11 +73,7 @@ Syntaxnya:
82
73
result =confirm(question);
83
74
```
84
75
85
-
<<<<<<< HEAD
86
-
Fungsi `confirm` menampilkan modal window dengan `pertanyaan` dan dua tombol: OK dan CANCEL.
87
-
=======
88
-
The function `confirm` shows a modal window with a `question` and two buttons: OK and Cancel.
89
-
>>>>>>> 8c30654f694fe8682f5631809980be931ee4ed72
76
+
Fungsi `confirm` menampilkan modal window dengan `pertanyaan` dan dua tombol: OK dan Cancel.
90
77
91
78
Hasilnya `true` jika OK ditekan dan `false` jika tidak.
92
79
@@ -106,17 +93,10 @@ Kita membahas 3 fungsi spesifik peramban untuk berinteraksi dengan pengunjung:
106
93
: menampilkan pesan.
107
94
108
95
`prompt`
109
-
<<<<<<< HEAD
110
-
: menampilkan pesan yang minta input teks pengguna. Ia mengembalikan teks atau, jika CANCEL atau `key:Esc` diklik, `null`.
96
+
: menampilkan pesan yang minta input teks pengguna. Ia mengembalikan teks atau, jika Cancel atau `key:Esc` diklik, `null`.
111
97
112
98
`confirm`
113
-
: menampilkan pesan dan menunggu pengguna menekan "OK" atau "CANCEL". It returns `true` for OK and `false` for CANCEL/`key:Esc`.
114
-
=======
115
-
: shows a message asking the user to input text. It returns the text or, if Cancel button or `key:Esc` is clicked, `null`.
116
-
117
-
`confirm`
118
-
: shows a message and waits for the user to press "OK" or "Cancel". It returns `true` for OK and `false` for Cancel/`key:Esc`.
119
-
>>>>>>> 8c30654f694fe8682f5631809980be931ee4ed72
99
+
: menampilkan pesan dan menunggu pengguna menekan "OK" atau "Cancel". Ia mengembalikan `true` untuk OK dan `false` untuk Cancel/`key:Esc`.
120
100
121
101
Semua metode ini ialah modal: mereka menyela exekusi script dan tak membolehkan pengunjung berinteraksi dengan apapun di laman hingga window ditutup.
0 commit comments