michael@0: function add(a, b, k) { michael@0: var result = a + b; michael@0: return k(result); michael@0: } michael@0: michael@0: function sub(a, b, k) { michael@0: var result = a - b; michael@0: return k(result); michael@0: } michael@0: michael@0: function mul(a, b, k) { michael@0: var result = a * b; michael@0: return k(result); michael@0: } michael@0: michael@0: function div(a, b, k) { michael@0: var result = a / b; michael@0: return k(result); michael@0: } michael@0: michael@0: function arithmetic() { michael@0: add(4, 4, function (a) { michael@0: // 8 michael@0: sub(a, 2, function (b) { michael@0: // 6 michael@0: mul(b, 3, function (c) { michael@0: // 18 michael@0: div(c, 2, function (d) { michael@0: // 9 michael@0: console.log(d); michael@0: }); michael@0: }); michael@0: }); michael@0: }); michael@0: } michael@0: michael@0: // Compile with closure compiler and the following flags: michael@0: // michael@0: // --compilation_level WHITESPACE_ONLY michael@0: // --source_map_format V3 michael@0: // --create_source_map code_math.map michael@0: // --js_output_file code_math.min.js michael@0: // michael@0: // And then append the sourceMappingURL comment directive to code_math.min.js michael@0: // manually.