Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1e28ff8

Browse files
committed
typos + clean-up wording
1 parent 1bd8f97 commit 1e28ff8

File tree

1 file changed

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

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ You could note the following:
44
```js no-beautify
55
function pow(x,n) // <- no space between arguments
66
{ // <- figure bracket on a separate line
7-
let result=1; // <- no spaces to the both sides of =
7+
let result=1; // <- no spaces before or after =
88
for(let i=0;i<n;i++) {result*=x;} // <- no spaces
99
// the contents of { ... } should be on a new line
1010
return result;
1111
}
1212

1313
let x=prompt("x?",''), n=prompt("n?",'') // <-- technically possible,
14-
// but better make it 2 lines, also there's no spaces and ;
14+
// but better make it 2 lines, also there's no spaces and missing ;
1515
if (n<0) // <- no spaces inside (n < 0), and should be extra line above it
1616
{ // <- figure bracket on a separate line
17-
// below - a long line, may be worth to split into 2 lines
17+
// below - long lines can be split into multiple lines for improved readability
1818
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
1919
}
2020
else // <- could write it on a single line like "} else {"
2121
{
22-
alert(pow(x,n)) // no spaces and ;
22+
alert(pow(x,n)) // no spaces and missing ;
2323
}
2424
```
2525

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /