Timeline for JavaScript, looping, and functional approach
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 20, 2020 at 13:58 | comment | added | FNMT8L9IN82 | Thank you much for your time and response! | |
Nov 19, 2020 at 12:48 | comment | added | Aleksei Tirman |
In this particular scenario, I don't think you should do it, but if you want to reuse them somewhere out of moveEvent then yes.
|
|
Nov 19, 2020 at 12:32 | comment | added | FNMT8L9IN82 | So you mean that I should take out selectedEvent, selectedItems, allItemsSelected into their own functions, and have moveEvent call those functions? | |
Nov 19, 2020 at 6:42 | comment | added | Aleksei Tirman |
@FNMT8L9IN82 yes, for the external observer it is pure function. But internally moveEvent has a sequence of statements and that is forbidden in purely functional languages.
|
|
Nov 19, 2020 at 3:54 | comment | added | CertainPerformance | @FNMT8L9IN82 I think, but I'm not 100% sure, that the idea is that functional programming avoids mutating scope - that is, variables are never defined except in arguments, resulting in functions that take arguments and immediately return new values every time. | |
Nov 19, 2020 at 0:15 | comment | added | FNMT8L9IN82 | Dumb question...isn't this already functional? it's a pure function that takes in two arguments, no global variables, and returns new data each time without modifying anything. I'm not sure what you mean about transform temp variables at the beginning. Isn't it already defining variables at the beginning? | |
Nov 19, 2020 at 0:12 | comment | added | FNMT8L9IN82 | Thank you so much! I like this approach over stackoverflow. This is easier and less to maintain. | |
Nov 19, 2020 at 0:11 | vote | accept | FNMT8L9IN82 | ||
Nov 18, 2020 at 18:30 | history | answered | Aleksei Tirman | CC BY-SA 4.0 |