Change Missing From Changelog: forEach() Loop's `Return` returns to forEach()'s invocation point, not to the calling function.
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- JavaScript
- Estrelas
- 11.8k
- Forks
- 7.9k
- Merge médio
- 1d 11h
- PRs com merge (30d)
- 11
Descrição
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.
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece com CHANGELOG.md e com a entrada do changelog do React 16.12.0 referenciada na issue. Verifique o comportamento relatado de forEach() com base nas referências vinculadas do MDN e do Stack Overflow e, em seguida, determine se falta uma entrada no changelog; considera-se concluído quando o relatório está validado e o changelog reflete corretamente o release, se apropriado.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- javascript, react
- Domínio
- documentation
- Tipo de issue
- Documentação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 30/100