Skip to content
New issue

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

Exercise 11 #105

Open
SimoNonnis opened this issue Oct 13, 2015 · 3 comments
Open

Exercise 11 #105

SimoNonnis opened this issue Oct 13, 2015 · 3 comments

Comments

@SimoNonnis
Copy link

If I give a name to the anonymous function and console.log() it,
I get this error:
"TypeError: movieLists.map(...).concatAll is not a function"

@kurzninja
Copy link
Contributor

You should probably post your whole code for the exercise so we can see exactly what you're doing.

@SimoNonnis
Copy link
Author

function foo() {
var movieLists = [
{
name: "New Releases",
videos: [
{
"id": 70111470,
"title": "Die Hard",
"boxart": "http://cdn-0.nflximg.com/images/2891/DieHard.jpg",
"uri": "http://api.netflix.com/catalog/titles/movies/70111470",
"rating": 4.0,
"bookmark": []
},
{
"id": 654356453,
"title": "Bad Boys",
"boxart": "http://cdn-0.nflximg.com/images/2891/BadBoys.jpg",
"uri": "http://api.netflix.com/catalog/titles/movies/70111470",
"rating": 5.0,
"bookmark": [{ id:432534, time:65876586 }]
}
]
},
{
name: "Dramas",
videos: [
{
"id": 65432445,
"title": "The Chamber",
"boxart": "http://cdn-0.nflximg.com/images/2891/TheChamber.jpg",
"uri": "http://api.netflix.com/catalog/titles/movies/70111470",
"rating": 4.0,
"bookmark": []
},
{
"id": 675465,
"title": "Fracture",
"boxart": "http://cdn-0.nflximg.com/images/2891/Fracture.jpg",
"uri": "http://api.netflix.com/catalog/titles/movies/70111470",
"rating": 5.0,
"bookmark": [{ id:432534, time:65876586 }]
}
]
}
];

// ------------   INSERT CODE HERE!  -----------------------------------
// Use map and concatAll to flatten the movieLists in a list of video ids.
// ------------   INSERT CODE HERE!  -----------------------------------

return movieLists.
  map(function(movieList) {
    return movieList.videos.map(function(video) {
        return video.id;
      });
  }).
      concatAll();

}

console.log(foo());

@MaxKroshka
Copy link

if you are trying to console.log it outside of http://reactivex.io/learnrx/ website, you should copy a definition of concatAll() function as well, since it's not a built function. You can find concatAll() function declaration in exercise 10 and copy it.
i just checked it in JS Bin with your code, it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants