ReactiveX / learnrx

A series of interactive exercises for learning Microsoft's Reactive Extensions Library for Javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exercise 13 - Should return be removed?

vishalsodani opened this issue · comments

When I remove the below commented lines I get an error; return not in function. And, if I remove return before JSON.stringify it works.

var spanishFrenchEnglishWords = [ ["cero","rien","zero"], ["uno","un","one"],  ["dos","deux","two"] ];
// collect all the words for each number, in every language, in a single, flat list
var allWords = [0,1,2].
    concatMap(function(index) {
        return spanishFrenchEnglishWords[index];
    });

return JSON.stringify(allWords) === '["cero","rien","zero","uno","un","one","dos","deux","two"]';

`

I get SyntaxError: Illegal return statement (but works fine after removing return statement)