Bad example | Sololearn: Learn to code for FREE!

+1

Bad example

Please dont use map like this, thats what forEach is for! Its bad practice to treat map as a foreach loop and use it to mutate closue state (sum in this case). Map is a functional tool to transform a collection by doing some operation on each member (e.g. [1,2,3].map(x=> x+1) === [2, 3, 4]. In functional programming styles you want to keep state as immutable as you can to increase readability. The example could be rewritten using reduce without mutation. Also- I dont think map/filter were introduced in this course. If not there should really be an introduction to these concepts instead of just dropping them in like this

2/26/2020 10:25:36 PM

Jonathan TheGreat

3 Answers

New Answer

+9

Jonathan TheGreat Can you please describe about which course and which topic has missed some concepts. What things should be their which you think is not present in the course right now. The courses are made to have an easy understanding of the concept and use of that concept. If you find anything missing you can post the comment on that code with an example code, so your code can be helpful for the other user to read. And mail sololearn if you find any bug as @HonFu said.

0

What part in what tutorial are you referring to? This is a public forum for programming-related questions. It would be probably best if you sent serious content criticism directly to [email protected]

0

The first quiz- I couldnt find a feedback section for that specifically, this was thr closest I saw. Apologies if its misplaced