javascript - 方法Object()里面传参数和不传参数有什么区别?
问题描述
比如这里target = Object(target)和target = Object()或者target = new Object()有什么区别?
if (typeof Object.assign != ’function’) { Object.assign = function(target) { ’use strict’; if (target == null) { throw new TypeError(’Cannot convert undefined or null to object’); } target = Object(target); for (var index = 1; index < arguments.length; index++) { var source = arguments[index]; if (source != null) {for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; }} } } return target; };}
问题解答
回答1:你不给参数的话他就是个空对象。。。
回答2:https://developer.mozilla.org...这篇文章讲得很清楚
相关文章:
1. 问题Unknown column ’’ in ’where clause’2. objective-c - ios 类似qq置顶的效果3. html - vue项目中用到了elementUI问题4. javascript - 在使用 vue.js element ui的时候 怎么样保留table翻页后check的值?5. mysql_replication - mysql读写分离时如果单台写库也无法满足性能怎么解决6. javascript - vue组件通过eventBus通信时,报错a.$on is not a function7. css3 - css怎么实现图片环绕的效果8. linux - ubuntu 命令行中文 显示菱形,期望通过引入字体解决而不是zhcon这种方式9. ionic 项目 ionic build android -release 打包时报错10. python - 如何用pandas处理分钟数据变成小时线?

网公网安备