MCPcopy Create free account
hub / github.com/marijnh/Eloquent-JavaScript / reliableMultiply

Function reliableMultiply

code/solutions/08_1_retry.js:11–20  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

9}
10
11function reliableMultiply(a, b) {
12 for (;;) {
13 try {
14 return primitiveMultiply(a, b);
15 } catch (e) {
16 if (!(e instanceof MultiplicatorUnitFailure))
17 throw e;
18 }
19 }
20}
21
22console.log(reliableMultiply(8, 8));
23// → 64

Callers 1

08_1_retry.jsFile · 0.85

Calls 1

primitiveMultiplyFunction · 0.85

Tested by

no test coverage detected