Skip to content

Commit a7f3481

Browse files
committed
feat(i18n): 1.03.02.1.solution
1 parent 958d974 commit a7f3481

File tree

1 file changed

+14
-14
lines changed
  • 1-js/03-code-quality/02-coding-style/1-style-errors

1 file changed

+14
-14
lines changed

1-js/03-code-quality/02-coding-style/1-style-errors/solution.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11

2-
You could note the following:
2+
Kamu bisa perhatikan berikut:
33

44
```js no-beautify
5-
function pow(x,n) // <- no space between arguments
6-
{ // <- figure bracket on a separate line
7-
let result=1; // <- no spaces before or after =
8-
for(let i=0;i<n;i++) {result*=x;} // <- no spaces
9-
// the contents of { ... } should be on a new line
5+
function pow(x,n) // <- tak ada spasi between arguments
6+
{ // <- menemukan bracket di baris terpisah
7+
let result=1; // <- tak ada spasi sebelum atau setelah =
8+
for(let i=0;i<n;i++) {result*=x;} // <- tak ada spasi
9+
// konten { ... } sebaiknya di baris baru
1010
return result;
1111
}
1212

13-
let x=prompt("x?",''), n=prompt("n?",'') // <-- technically possible,
14-
// but better make it 2 lines, also there's no spaces and missing ;
15-
if (n<0) // <- no spaces inside (n < 0), and should be extra line above it
16-
{ // <- figure bracket on a separate line
17-
// below - long lines can be split into multiple lines for improved readability
13+
let x=prompt("x?",''), n=prompt("n?",'') // <-- secara teknis memungkinkan,
14+
// tapi lebih baik buat 2 baris, juga tak ada spasi dan kehilangan ;
15+
if (n<0) // <- tak ada spasi di dalam (n < 0), dan harus ada baris extra line di atasnya
16+
{ // <- menemukan bracket di baris baru
17+
// di bawah - baris panjang bisa dipisah menjadi baris ganda untuk keterbacaan lebih baik
1818
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
1919
}
20-
else // <- could write it on a single line like "} else {"
20+
else // <- bisa menulisnya di baris tunggal seperti "} else {"
2121
{
22-
alert(pow(x,n)) // no spaces and missing ;
22+
alert(pow(x,n)) // tak ada spasi dan kehilangan ;
2323
}
2424
```
2525

26-
The fixed variant:
26+
Varian yang dibetulkan:
2727

2828
```js
2929
function pow(x, n) {

0 commit comments

Comments
 (0)