Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/OBKoro1/web-basics
/ array-reduce.js
File
array-reduce.js
src/js/arrayFunction/array-reduce.js:None–None ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
1
// reduce的实现原理
2
Array.prototype.reduce1 =
function
(cb, prev) {
3
for
(
let
i = 0; i < this.length; i++) {
4
if
(prev === undefined) {
Callers
nothing calls this directly
Calls
2
flatFnn
Function · 0.85
compose
Function · 0.70
Tested by
no test coverage detected