@@ -4,22 +4,22 @@ You could note the following:
44``` js no-beautify
55function 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
1313let 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 ;
1515if (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}
2020else // <- 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