即使 assignEvent 函数只是分配并且不返回任何值。我仍然看到在下面的代码中打印出价值。为什么 des 它在下面的代码中打印 19.99?
let event = {
name: "hot dog and burger sunday",
financials: {
baseCost: "19.99",
discountsAvailable: false,
maxCost: '29.99'
},
subscribers: [
// lots of subscribers here
]
}
let eventPrice;
const assignEvent = ({financials: {baseCost: price }}) => eventPrice = price
console.log(assignEvent(event));