RESOLVED FIXED227939
Implement Array.prototype.findLast and Array.prototype.findLastIndex
https://bugs.webkit.org/show_bug.cgi?id=227939
Summary Implement Array.prototype.findLast and Array.prototype.findLastIndex
Devin Rousso
Reported 2021-07-13 20:05:28 PDT
`Array.prototype.findLast` and `Array.prototype.findLastIndex` just advanced to TC39 stage 3 Proposal: <https://github.com/tc39/proposal-array-find-from-last> Spec: <https://tc39.es/proposal-array-find-from-last/index.html> ``` const array = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 4 }]; array.find(n => n.value % 2 === 1); // { value: 1 } array.findIndex(n => n.value % 2 === 1); // 0 array.findLast(n => n.value % 2 === 1); // { value: 3 } array.findLastIndex(n => n.value % 2 === 1); // 2 ```
Attachments
[Patch] WIP (11.13 KB, patch)
2021-07-13 21:02 PDT, Devin Rousso
no flags
Patch (42.75 KB, patch)
2021-07-14 13:01 PDT, Devin Rousso
no flags
Patch (42.85 KB, patch)
2021-07-14 14:27 PDT, Devin Rousso
no flags
Patch (42.81 KB, patch)
2021-07-14 17:47 PDT, Devin Rousso
no flags
Devin Rousso
Comment 1 2021-07-13 21:02:24 PDT
Created attachment 433476 [details] [Patch] WIP
Yusuke Suzuki
Comment 2 2021-07-13 22:52:07 PDT
Comment on attachment 433476 [details] [Patch] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=433476&action=review r=me > Source/JavaScriptCore/builtins/ArrayPrototype.js:269 > + var kValue = array[i]; I like the name like `element` instead of `kValue` even though it is derived from the spec's name since the name is not suitable for WebKit's coding style.
Yusuke Suzuki
Comment 3 2021-07-13 22:52:37 PDT
Comment on attachment 433476 [details] [Patch] WIP Can you add tests in JSTests/stress?
Devin Rousso
Comment 4 2021-07-14 13:01:29 PDT
Devin Rousso
Comment 5 2021-07-14 14:27:08 PDT
Devin Rousso
Comment 6 2021-07-14 17:47:11 PDT
EWS
Comment 7 2021-07-14 20:12:00 PDT
Committed r279937 (239681@main): <https://commits.webkit.org/239681@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 433547 [details].
Radar WebKit Bug Importer
Comment 8 2021-07-14 20:13:17 PDT
Note You need to log in before you can comment on or make changes to this bug.