FreeCodeCampChina / FreeCodeCampChina/freecodecamp.cn

请教大神,为什么用多维数组不可以了???

Open
#619 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
37.8k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

Challenge [Filter Arrays with filter](https://www.freecodecamp.cn/challenges/filter-arrays-with-filter#?solution=var%20oldArray%20%3D%20%5B%5B1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%5D%2C%5B1%2C2%2C3%2C4%2C5%2C6%2C7%5D%5D%3B%0A%0A%2F%2F%20%E5%8F%AA%E8%83%BD%E5%9C%A8%E8%BF%99%E4%B8%80%E8%A1%8C%E4%B8%8B%E9%9D%A2%E5%86%99%E4%BB%A3%E7%A0%81%0A%0Avar%20newArray%20%3D%20oldArray.filter(function(arrOne%2CarrTwo)%7B%0A%20%20%0A%20%20var%20newArrOne%3DarrOne.filter(function(val)%7B%0A%20%20%20%20return%20val%3C6%3B%0A%20%20%20%20%0A%20%20%7D)%3B%0A%20var%20newArrTwo%3DarrTwo.filter(function(val)%7B%0A%20%20%20%20return%20val%3C6%3B%0A%20%20%20%20%0A%20%20%7D)%3B%0A%20%20return%20%5BnewArrOne%2CnewArrTwo%5D%3B%0A%7D)%3B%0A) has an issue.
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:
```javascript
var oldArray = [[1,2,3,4,5,6,7,8,9,10],[1,2,3,4,5,6,7]];

// 只能在这一行下面写代码

var newArray = oldArray.filter(function(arrOne,arrTwo){

var newArrOne=arrOne.filter(function(val){
return val<6;

});
var newArrTwo=arrTwo.filter(function(val){
return val<6;

});
return [newArrOne,newArrTwo];
});

```
新手请教大神,多维数组用.filter为什么运行不了???

是.filter不适用多维数组???

还是我的代码有问题呢???

Contributor guide

Open the contributing guide

Research direction

Start at the linked “Filter Arrays with filter” challenge and review its expected callback inputs and constraints. Reproduce the provided nested-array example there; done means the reported behavior is explained and any needed correction to the challenge or lesson is clearly identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
content
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.