function makeSaver(callable) { let res, executed = !1; return function() { return executed ? res : (executed = !0, res = callable()); }; }; var saver = makeSaver(Math.random); value1 = saver(); value2 = saver(); alert(value1 === value2);