All Questions
7 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 ...
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.
...
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
<...
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. ...
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 ...
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 ...
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. ...