Solution · code-edit

find() 與 some()

對照完整答案、責任邊界與原因。

Solution 要做什麼

對照完整答案、責任邊界與原因。

本主題檔案:files/main.js

定位:先問呼叫端需要資料本身還是只需要答案。

本階段驗收

頁面不會替你修改檔案;請在實作檔完成後重新整理確認。

目前要處理

同一變數同時被當物件與 Boolean。

預期看到

foundId=s2、exists=true、foundType=object、existsType=boolean。

services.find(s => s.featured) 與 services.some(s => s.featured)。

檔案清單

只在本階段資料夾內操作,避免改到其他章節。

證據:foundId=s2、exists=true、type 分別 object/boolean

回到主題說明