Pomodoro Timer feedback request

Pomodoro Timer feedback request
0.0 0


I was looking for feedback on my Pomodoro timer, so added it as a reply to 'Let’s discuss your “Pomodoro Clock”'
That was 5 days ago, but nothing turned up. Then I realized I should have posted in ‘Project Feedback’ so here it is.

Project Link - https://codepen.io/roygrubb/pen/egNmRz/
I have a couple of general but related questions about parameter passing and functional programming:

General comment: I imitated the sample, as I usually do with FreeCodeCamp exercises, because for me it turns out to be more of a challenge. If I build to my own design, I’ll probably use techniques I know. But if I try to imitate the example FreeCodeCamp gives us, I often have to work harder to find out how it’s done (without looking at the example code, of course).

  1. I’d appreciate feedback on my code.

  2. And I’m looking for comment on how I use an array passed to functions (and often returned with updates) to avoid globals and achieve some of the goals of functional programming. The disadvantage is that readability is affected, as there’s a need for the developer to refer to comments to find out what, e.g., ar[4] is.
    Is this an accepted approach? Are there better alternatives? I don’t want functions to change anything it hasn’t been passed in parameters.

  3. All the same, I do change elements in the DOM from within functions, just not variables. As that’s only the UI, I feel that this doesn’t violate the ideas behind functional programming too much. Is that right?

(Reposted - originally was in https://forum.freecodecamp.com/t/lets-discuss-your-pomodoro-clock/6176/118)


Responding to myself a month later on the question of passing arrays, and readability: I eventually realized that passing objects would be better, as I can still pass and return one parameter, the whole object ( ob ) instead of ( ar ), but the function’s code can refer to something like, say, ob.score instead of ar[4]. Much clearer, and no need to keep looking up comments.

I was able to refactor a small app of 350 lines in about 40 minutes.

Probably blindingly obvious, but maybe not to all we learners.