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
'use strict' var arr = [1,2,3,4,5,6,7,8,9,0]; var group = [[],[],[],[]]; (function split(arr, group) { var size = group.length; // 分多少组 var length = arr.length; // 人数总长度 // 每次随机叫一个人,跳进一个组里,并从原数组里踢掉 while(arr.length) { for(let i = 0; i < length; i++){ let index = Math.random() * arr.length | 0; // 随机 group[i % size].push(arr.splice(index, 1)[0]); // 踢掉并入组 } } console.log(group); })(arr, group);
The text was updated successfully, but these errors were encountered:
sofish/learn-js#8
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: