Skip to content

Instantly share code, notes, and snippets.

/*
Ensure that multiple calls to the calculateCheap function
with the same argument will not result in multiple
calls to the calculateExpensive function.
Expected console output:
calculateExpensive called with = 2
result = 4
result = 4
result = 4