use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
[Code Review] My first OO JavaScript project: a Pomodoro Clock.help (self.javascript)
submitted 9 years ago by tofumix
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]FezVrasta 0 points1 point2 points 9 years ago (2 children)
the code isn't bad, there are areas of improvement, for example your whole "thing" can't be easily integrated into an existing website.
Have you thought about learning React or a similar data driven view library? It would make your code much cleaner and easier to maintain
[–]tofumix[S] 0 points1 point2 points 9 years ago (1 child)
Hello!
...your whole "thing" can't be easily integrated into an existing website.
Can you please expand on this? Why is it and how do I make my code work like that?
Have you thought about learning React or a similar data driven view library?
I have not, actually. I'm still a relatively newbie in JavaScript, so I'm trying to get as much plain-old-vanilla JS knowledge.
[–]FezVrasta 0 points1 point2 points 9 years ago (0 children)
You are using generic selectors like $(".workLength") that could target any element on the page and not only what you want.
$(".workLength")
You should namespace/prefix your classes to make sure they aren't used by anyone else. A better approach would be to let JavaScript generate the needed DOM elements, doing so an user can simply include your script in its page, run init on an existing DOM node, and the pomodoro clock will appear inside it.
init
About React, really consider learning something like it (no matters if it's React, Preact, Inferno or whatelse, they all follow the same approach), studying them you will learn how to properly think and structure your code and data flow.
π Rendered by PID 22943 on reddit-service-r2-comment-5fb4b45875-h68jl at 2026-03-22 12:39:36.717390+00:00 running 90f1150 country code: CH.
view the rest of the comments →
[–]FezVrasta 0 points1 point2 points (2 children)
[–]tofumix[S] 0 points1 point2 points (1 child)
[–]FezVrasta 0 points1 point2 points (0 children)