I would like to have something like this implemented in javasript please:
var hat = new Hat(Hat.Color.RED, Hat.Size.MEDIUM);
How can I do it please (tried to mess with function prototype but with a little success)?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Hatwill be a constructor function:On the prototype are “methods” for
Hatinstances:But the constants are properties of the Function object:
If your library implements the “extend” function correctly (nothing special on constructors), this should also work: