Merge pull request #737 from 11un/patch-5

typos + clean-up wording
This commit is contained in:
Ilya Kantor 2019-01-15 00:16:53 +03:00 committed by GitHub
commit 32a8c35485
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,22 +4,22 @@ You could note the following:
```js no-beautify
function pow(x,n) // <- no space between arguments
{ // <- figure bracket on a separate line
let result=1; // <- no spaces to the both sides of =
let result=1; // <- no spaces before or after =
for(let i=0;i<n;i++) {result*=x;} // <- no spaces
// the contents of { ... } should be on a new line
return result;
}
let x=prompt("x?",''), n=prompt("n?",'') // <-- technically possible,
// but better make it 2 lines, also there's no spaces and ;
// but better make it 2 lines, also there's no spaces and missing ;
if (n<0) // <- no spaces inside (n < 0), and should be extra line above it
{ // <- figure bracket on a separate line
// below - a long line, may be worth to split into 2 lines
// below - long lines can be split into multiple lines for improved readability
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
}
else // <- could write it on a single line like "} else {"
{
alert(pow(x,n)) // no spaces and ;
alert(pow(x,n)) // no spaces and missing ;
}
```