The code below runs without an error, but its result is wrong. Which statement correctly identifies the bug?
const currency = "USD";
function format(amount) {
return `${amount} ${currency}`;
}
function indianPrice(amount) {
const currency = "INR";
return format(amount);
}
console.log(indianPrice(500));
A function never sees its caller's local variables. function format(amount, currency = "USD") and format(amount, "INR") fixes it.