# Hi everyone ,how to create list inside list in test

**URL:** <https://community.postman.com/t/hi-everyone-how-to-create-list-inside-list-in-test/43519>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [February 2, 2023, 2:42pm UTC](https://community.postman.com/t/hi-everyone-how-to-create-list-inside-list-in-test/43519 "2023-02-02T14:42:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![salma224](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@salma224](https://community.postman.com/u/salma224)\
**Post date:** [February 2, 2023, 2:42pm UTC](https://community.postman.com/t/hi-everyone-how-to-create-list-inside-list-in-test/43519/1 "2023-02-02T14:42:23Z")

</div>

i have this code but not work i wanna to get all item and filter this items and put it in new list  
he print first list correct but second list not have items

 ![api error for tracks](https://us1.discourse-cdn.com/getpostman/original/3X/7/7/77f5340a8e69f6275bf222695e3d5345e7138151.png)

```auto
const response = pm.response.json()

let allTracks = response.map(item => item.track);

console.log(allTracks);

for(let i = 0; i < allTracks.length; i++){

if (allTracks[i] != "Software Testing"){

let Tracks = response.map(allTracks[i]); ;

console.log(Tracks);

}

}

```

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [February 2, 2023, 6:38pm UTC](https://community.postman.com/t/hi-everyone-how-to-create-list-inside-list-in-test/43519/2 "2023-02-02T18:38:02Z")

</div>

Your descriptions of what you want to achieve are not very clear.

It might be a language barrier, but I can’t ascertain what you are trying to achieve so any help will be limited as I’m totally guessing on what you are trying to achieve.

This line though…

```auto
let Tracks = response.map(allTracks[i]); ;

```

allTracks[i] will just be a string with the value of the current track if its not “Software Testing”.

I’m surprised the map function is not returning an error at this point as the command is not complete. Map what to what? You just have a single variable. The map function is incomplete.

What is it you are trying to do?

Do you just want an array of the tracks that are not “Software Testing”?

This can be done using the JavaScript “filter” function.

```auto
let allTracks = response.map(item => item.track);
console.log(allTracks);

let tracks = allTracks.filter(track => track != "Software Testing");
console.log(tracks);

```
