Array.prototype.find() - JavaScript | MDN
5
公开标注数
5
参与人数
2026-07-19 09:18:27
首次 Whisper
本页的公开 Whisper
划选高亮2026-07-19 12:39:27
原文高亮摘录
“Empty slots in sparse arrays are visited, and are treated the same as undefined.”
Whisper 随想笔记
Huh, I always thought it'd just skip them. Good to know.
划选高亮2026-07-19 12:30:27
原文高亮摘录
“Empty slots in sparse arrays are visited, and are treated the same as undefined.”
Whisper 随想笔记
Wait so holes count as undefined? That changes how I debug my code.
划选高亮2026-07-19 09:36:27
原文高亮摘录
“The following example returns the first element in the array that is a prime number, or undefined if there is no prime number.”
Whisper 随想笔记
That's basically my go-to trick for finding stuff in arrays.
划选高亮2026-07-19 09:27:27
原文高亮摘录
“The following example returns the first element in the array that is a prime number, or undefined if there is no prime number.”
Whisper 随想笔记
Wish they'd show a non-prime example too, but okay.
划选高亮2026-07-19 09:18:27
原文高亮摘录
“The following example returns the first element in the array that is a prime number, or undefined if there is no prime number.”
Whisper 随想笔记
I always forget it returns undefined and not null, good reminder.
分享本页 Whisper
短链接
https://domwhisper.com/s/b69ad6fb53db嵌入代码
<iframe src="https://domwhisper.com/embed/b69ad6fb53db" width="100%" height="480" style="border:0;border-radius:16px" loading="lazy"></iframe>