Wrong return value (CH3, Array methods, Finding elements)
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 65/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- javascript
调研方向
找到 issue 中描述的 CH3 > Array methods > Finding elements 段落,并检查其中对 callback 和 find() 的解释。修改措辞,使其区分 callback 的布尔结果与 find() 返回的元素,包括未找到匹配项时返回 undefined 的情况。
由索引模型根据 Issue 内容生成。
描述
There's a mistake in CH3 > Array methods > Finding elements
The mistake is in saying that the function “returns the element” when the condition is met. In this code, the callback function does not return the element itself. It returns the result of the comparison e === 6 or e === 10, which is a boolean value (true or false). The function’s job is only to tell find() whether the current element matches the condition.
The correct explanation is that the callback function returns true when the element satisfies the condition, and false otherwise. When find() receives true from the callback, it stops iterating and returns the corresponding element from the array. If the callback never returns true, then find() returns undefined.
- 主要语言
- HTML
- 星标
- 375
- 派生
- 216
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PacktPublishing/JavaScript-from-Beginner-to-Professional 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 5/100
PacktPublishing/JavaScript-from-Beginner-to-Professional#10 ·
-
难度 1/5 1 小时以内 新手友好度 45/100
PacktPublishing/JavaScript-from-Beginner-to-Professional#9 ·
-
难度 1/5 1 小时以内 新手友好度 45/100
PacktPublishing/JavaScript-from-Beginner-to-Professional#6 · 1 条评论 ·
查看 PacktPublishing/JavaScript-from-Beginner-to-Professional 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
vuln:LOW
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
after-v0.1.0 bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
agent-butler-finding bug
难度 1/5 1-3 小时 新手友好度 84/100
jordansmall/spindrift#6557 ·
维护者通常 1 天内回复
-
Blog update untriaged
难度 2/5 1-3 小时 新手友好度 84/100