Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/braziljs/eloquente-javascript
/ loop
Function
loop
code/solutions/05_2_your_own_loop.js:1–5 ·
view source on GitHub ↗
(start, test, update, body)
Source
from the content-addressed store, hash-verified
1
function
loop(start, test, update, body) {
2
for
(
let
value = start; test(value); value = update(value)) {
3
body(value);
4
}
5
}
6
7
loop(3, n => n > 0, n => n - 1, console.log);
8
// → 3
Callers
1
05_2_your_own_loop.js
File · 0.70
Calls
1
update
Function · 0.85
Tested by
no test coverage detected