We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var arr = [1,2,3]; var obj = Object.assign({},arr); console.info(obj); //{0: 1, 1: 2, 2: 3}
2.方式2
var obj = {}; var arr = [1,2,3]; arr.unshift.apply(obj,arr); console.info(obj); //{0: 1, 1: 2, 2: 3, length: 3}
其中比较直观的区别是方式2中的对象会多一个length属性
在时间上如果比较效率的话有图为证
在不考虑兼容性的情况下,方式1跟好一点 兼容性 在移动端目前支持不太好。
The text was updated successfully, but these errors were encountered:
var arr = [].slice.call(document.querySelectorAll('.controls input'));
Sorry, something went wrong.
No branches or pull requests
1.方式1-es6简单粗暴
2.方式2
其中比较直观的区别是方式2中的对象会多一个length属性
在时间上如果比较效率的话有图为证
在不考虑兼容性的情况下,方式1跟好一点
兼容性
在移动端目前支持不太好。
The text was updated successfully, but these errors were encountered: