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 = [ [11, 22, 22], [13, 14, 15, 15], [16, 17, 18, 19, [11, 12, [12, 13, [14] ] ] ], 12];
The text was updated successfully, but these errors were encountered:
参考答案:
//flat方法接受一个参数n,可以将深度为n的数组扁平化,然后去重并排序,去重可以用set,排序用sort // 当然也可以使用递归等其他方法 var newArray = Array.from(new Set(arr.flat(Infinity))).sort((a,b) => a-b); console.log(newArray);
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: