7 Iterators - 3 .map


#1

In exercise 3, my code successfully works out the small numbers (I printed to console.log to check) but the answer was not accepted as correct.

let smallNumbers = bigNumbers.map(numbers => numbers/100);

When I ‘asked for the code’ it inserted

let smallNumbers = bigNumbers.map(num => num/100);

How are we supposed to know to use ‘num’ if it doesn’t say so in the instructions?

Also, the ‘go to forums’ button goes to a 404.


#2

You’re not.

When you wrote this post, how did you recreate your code? I think you might have used the solution that was given to you, and you changed the variable name, but there was something else that was different which you didn’t notice, that the code you tried was something other than what you’re showing in your post.


#3

As afar as I remember now, I wrote the block…

let smallNumbers = bigNumbers.map(numbers => numbers/100);

With an additional…

console.log(smallNumbers);

…to check it which printed the right result, but I still got an error. Even when I removed the console.log line, I still got the error so I then asked for the code in the modal.


#4

This is an issue that is best reported to the dev team. Please use the Report A Bug tool provided in each lesson. Thanks.


#5

Please post a link to the exercise so we may verify your outcome. Thanks.


#6

OK. I’ve filed that to the dev team now.


#7

Not sure if You can investigate further as it now works OK with ‘numbers’ instead of ‘num’, but the link is: 7. Iterators 3. Map

Thanks for responding though :slight_smile:


#8

Use .map() to divide all the numbers in bigNumbers by 100. Save the returned values to a new array called smallNumbers, declared with let.

When the instructions supply the names we are to use for variables, it is usually best to use them, as this will be expected by the SCT. For best results, stick with the instructions rather than taking liberties.


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.