调用同一个函数,变量控制传参
let variableData = true ? {
address: "北京"
} : {}
getData(variableData)
getData()
function getData (variableData) {
let data ={
name: "上海"
}
data = Object.assign({}, data, variableData)
console.log(data)
}