The code for 3rd edition's 8.1 exercise is using the following pre-filled code:
class MultiplicatorUnitFailure extends Error {}
function primitiveMultiply(a, b) {
if (Math.random() < 0.2) {
return a * b;
} else {
throw new MultiplicatorUnitFailure("Klunk");
}
}
However, when showing the solution in the Code Sandbox, the following pre-filled code is used (from 2nd edition):
function MultiplicatorUnitFailure() {}
function primitiveMultiply(a, b) {
if (Math.random() < 0.5) {
return a * b;
} else {
throw new MultiplicatorUnitFailure();
}
}
The code for 3rd edition's 8.1 exercise is using the following pre-filled code:
However, when showing the solution in the Code Sandbox, the following pre-filled code is used (from 2nd edition):
Steps to reproduce:
look at the solution
at the bottom