Javascript 对象扩展语法从不抛出错误吗?
我注意到Object Spread语法对它可以接受哪种类型的值非常宽容:Javascript 对象扩展语法从不抛出错误吗?,javascript,spread-syntax,ecmascript-2018,Javascript,Spread Syntax,Ecmascript 2018,我注意到Object Spread语法对它可以接受哪种类型的值非常宽容: console.log({…true}); log({…false}); log({…0}); log({…42}); log({…-1}); log({…NaN}); log({…'batman'}); console.log({…/\w+[0-9a-fA-F]?/}); log({…['foo','bar',42]}); log({…未定义}); log({…false}); log({…Symbol('hmm')}
console.log({…true});
log({…false});
log({…0});
log({…42});
log({…-1});
log({…NaN});
log({…'batman'});
console.log({…/\w+[0-9a-fA-F]?/});
log({…['foo','bar',42]});
log({…未定义});
log({…false});
log({…Symbol('hmm')});
log({…Promise.resolve('resolved')});
log({…Promise.reject('rejected'))代码>