其他分享
首页 > 其他分享> > 日常开发记录-TypeError : Invalid attempt to spread non-iterable instance

日常开发记录-TypeError : Invalid attempt to spread non-iterable instance

作者:互联网

错误原因:...延展运算符使用语法报错

let arr1 = [{name: 'yibo1111',age :24}]
let arr2 = [{name: 'yibo3333',age :24}]
function test(a, b) {
    return [...a, ...b]
}

console.log(test(arr1, arr2))

效果:

 

标签:24,...,non,TypeError,name,age,instance,let,test
来源: https://www.cnblogs.com/huguo/p/16434687.html