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 642b563

Browse files
committed
edited alice's wage difference, wage is based on the average of her male counterparts and rounded up for easy comprehension.
1 parent 9acc130 commit 642b563

File tree

1 file changed

+3
-3
lines changed
  • 1-js/06-advanced-functions/01-recursion

1 file changed

+3
-3
lines changed

‎1-js/06-advanced-functions/01-recursion/article.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ let company = {
302302
salary: 1000
303303
}, {
304304
name: 'Alice',
305-
salary: 600
305+
salary: 1600
306306
}],
307307
308308
development: {
@@ -350,7 +350,7 @@ The algorithm is probably even easier to read from the code:
350350
351351
```js run
352352
let company = { // the same object, compressed for brevity
353-
sales: [{name: 'John', salary: 1000}, {name: 'Alice', salary: 600 }],
353+
sales: [{name: 'John', salary: 1000}, {name: 'Alice', salary: 1600 }],
354354
development: {
355355
sites: [{name: 'Peter', salary: 2000}, {name: 'Alex', salary: 1800 }],
356356
internals: [{name: 'Jack', salary: 1300}]
@@ -372,7 +372,7 @@ function sumSalaries(department) {
372372
}
373373
*/!*
374374
375-
alert(sumSalaries(company)); // 6700
375+
alert(sumSalaries(company)); // 7700
376376
```
377377
378378
The code is short and easy to understand (hopefully?). That's the power of recursion. It also works for any level of subdepartment nesting.

0 commit comments

Comments
(0)

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