Bad example | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

26th Feb 2020, 10:25 PM
Jonathan TheGreat
Jonathan TheGreat - avatar
3 Answers
+ 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.
28th Feb 2020, 6:20 AM
GAWEN STEASY
GAWEN STEASY - avatar
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 info@sololearn.com.
26th Feb 2020, 10:49 PM
HonFu
HonFu - avatar
0
The first quiz- I couldnt find a feedback section for that specifically, this was thr closest I saw. Apologies if its misplaced
27th Feb 2020, 4:45 PM
Jonathan TheGreat
Jonathan TheGreat - avatar