我的JavaScript函数导致控制台返回:
TypeError: style is null
以下是代码片段:
let style = {
one: 1,
two: 2,
three: 3
}
function styling(style = style, ...ruleSetStock) {
return ruleSetStock.map(ruleSet => {
console.log(ruleSet)
return style[ruleSet]
})
}
console.log(styling(null, "one", "two", "three"))
我不明白为什么。在我看来,一切都很好,
有任何提示都将是极好的,谢谢。