-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Help I've Found a Bug
Alber edited this page Jan 12, 2017
·
66 revisions
Steamroller 对嵌套的数组进行扁平化处理。你必须考虑到不同层级的嵌套。
如果你被卡住了,记得开大招 Read-Search-Ask。尝试与他人结伴编程、编写你自己的代码。
var result = new Array(); function steamroller(arr) { // I'm a steamroller, baby for(var i=0;i<arr.length;i++){ if(Array.isArray(arr[i])){ steamroller(arr[i]); }else{ result.push(arr[i]); } } return result; }
can't pass!!!