Skip to main content

All Questions

2 votes
1 answer
554 views

Constructor function for persons with hobbies

I'm trying to write a constructor function that generates instances of a user. One of the properties of the user class is an array of the user's hobbies. I'd like ...
Anthony's user avatar
  • 191
6 votes
1 answer
221 views

2d game enemy entities factories, probably in need of refactoring

So I'm making a 2d shoot'em up game as a way of learning canvas, and larger-scale programming than what I'm accustomed to. I'm a purely front-end web dev, I can't say I'm very experienced in this. ...
Antonin Cezard's user avatar
4 votes
2 answers
248 views

Follow up - Creating Inheritance hierarchy using function constructor

In continuation with this question, Animal class has four fields: name sound <...
overexchange's user avatar
  • 3,401
8 votes
1 answer
797 views

Creating Inheritance hierarchy using function constructor

Problem statement You need to create the Animal base class having four fields: a. name b. ...
overexchange's user avatar
  • 3,401
0 votes
1 answer
124 views

YUIDoc syntax for optionally static constructor

In JavaScript, I wrote a class that can be optionally instantiated with the new keyword, but can also be called statically as well. What is the best way to ...
Patrick Roberts's user avatar
3 votes
1 answer
108 views

Elegant way of processing an "options" parameter

In this constructor function I'm assigning everything to the proper variables. For the third parameter it accepts an options argument that contains the optional ...
Kid Diamond's user avatar
  • 2,601
1 vote
1 answer
183 views

"metaconstructors" for inheritance in js?

Edit - decl smokes dojo.declare - http://jsperf.com/dojo-declare-vs-decl The code has been updated a bit. ...
Dagg's user avatar
  • 4,541