Change Missing From Changelog: forEach() Loop's `Return` returns to forEach()'s invocation point, not to the calling function.
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 11.8k
- 分支
- 7.9k
- 平均合併
- 1 天 11 小時
- 30 天內合併 PR
- 11
描述
Hey all,
I'm noticing that in upgrading to ReactJS Version 16.12.0 from 16.7.0, the behavior of foreach was changed, so that return returns to where foreach is called, and not the function calling the function containing the foreach. But I don't see this change here:
https://github.com/facebook/react/blob/master/CHANGELOG.md
Basically,
function1() {
function2();
console.log("function 1");
}
function2() {
const arr = ['cool'];
arr.forEach((var) => {
return var;
});
console.log("function 2");
}
Before 16.12.0, console output was: "function 1", but now it is "function 2; function 1." This change appears to be against MDN documentation and internet consensus: https://stackoverflow.com/questions/34653612/what-does-return-keyword-mean-inside-foreach-function
But it should have been included in the changelog, though I am not seeing it. Let me know if I'm misunderstanding.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 CHANGELOG.md 以及 issue 中引用的 React 16.12.0 changelog 項目開始。根據連結的 MDN 和 Stack Overflow 參考資料驗證所回報的 forEach() 行為,然後判斷 changelog 是否缺少項目;當報告獲得驗證,且 changelog 在適用的情況下準確反映該版本發布時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript, react
- 領域
- documentation
- Issue 類型
- 文件
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 30/100