前端学习笔记202310学习笔记第一百壹拾一天-作用域&作用域链&预编译&闭包基础17
function breadMsg(num) {
var breadNum = arguments[0] || 10
function supply() {
breadNum += 10
console.log(breadNum)
}
function sale() {
breadNum -= 10
console.log(breadNum)
}
return [supply, sale]
}
var breadMsg = breadMsg(50)
breadMsg[0](10)
breadMsg[0](11)
运行结果