Question 10
Consider the following JavaScript program:
function createMultiplier(base) { let multiplier = base;
function updateMultiplier(newValue) { multiplier = newValue; return multiplier; }
function multiply(num) { return num * multiplier; }
return { update: updateMultiplier, calculate: multiply, getMultiplier: function() { return multiplier; } };}
const math1 = createMultiplier(3);const math2 = createMultiplier(5);
console.log(math1.calculate(4));console.log(math2.calculate(2));console.log(math1.update(7));console.log(math1.calculate(4));console.log(math2.getMultiplier());console.log(math1.getMultiplier());What will be the output of the above program?
12, 10, 7, 12, 5, 7
12, 10, 7, 28, 5, 7
12, 10, 3, 28, 5, 3
15, 10, 7, 28, 7, 7
12, 10, 7, 21, 5, 7