-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
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
数组扁平化、去重、排序 #28
Comments
数组扁平化的处理,flat方法浏览器支持度很差,还是建议用递归的方式处理下 |
@sunnyBob 如果涉及到浏览器,早在babel阶段就会对flat方法自动转化了 |
@sunnyBob 你要引入@babel/polyfill啊,这个flat方法是polyfill实现的,怎么不会解决这种浏览器兼容问题? |
好的,查了下 core-js@3 增加了 flat 支持 |
var arr = [ [1, 2, 2], [3, 4, 5, 5], [6, 7, 8, 9, [11, 12, [12, 13, [14] ] ] ], 10] |
我想到的也是用 toString去扁平化,不知道会不会有什么边界问题没办法处理 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
看一道面试题:
答案:
关于 Set 请查阅 Set、WeakSet、Map及WeakMap
The text was updated successfully, but these errors were encountered: