Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
![](/static/devrant/img/pipeless-devrant-banner-white.png)
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I can't see a fancy way to remove them, although I nejther do a lot of JS nor any angularjs.
Whats wrong with it? -
@ComradeBob for starters the first if prevents you from Subscribing to the observable, the "avoid undefined" logic could go in a set method, and tbh it also looks ulgy as hell
-
I noticed that often when I need too much ifs, using a finite state machine can be a better solution. Of course this doesn't apply to all problems.
-
Sekhat637yWhy doesn't the ppGame do it's own initialisation.
Why do those arrays need creating outside of the ppGame in the first place? So many if statements could just be removed by giving the ppGame a constructor that does all that.
Please please use empty arrays to mean no results. Not null/undefined. That way you can treat it uniformly everywhere.
Related Rants
If you do this, please, don't have children.
P.D. count the number of *if*s
rant
kill me pliz
thinking of my children
frankencode
bad code
pichardo for president
ng cry
angular