airbnb / airbnb/javascript

Confusing examples in 4.5

Open
#1,264 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
148k
Forks
26.6k
PR merge metrics
No merged PRs in 30d

Description

[Chapter 4.5](https://github.com/airbnb/javascript/blob/master/README.md#arrays--callback-return) contains some confusing examples.

1. `map` examples have not corresponding bad examples. What bad cases they advise against?
2. `reduce` bad example is just wrong, it throws `TypeError: Cannot read property 'concat' of undefined`. `reduce` callback can't be used without `return` statement.
3. `filter` examples seem to be just a case of something like ['no-else-return'](http://eslint.org/docs/rules/no-else-return) ESLint rule.

Contributor guide

No contributing guide indexed for this repository

Research direction

Open Chapter 4.5 in README.md and review the map, reduce, and filter examples described in the issue. Check the reduce example's behavior and compare the filter guidance with the linked no-else-return rule. Done means the examples are correct and each listed concern is clearly addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.