Re: How to initial a object properties by functions?



RobG wrote:
[...]
// By convention, constructors start with a capital letter
function ClientENV()
{
// Set some default property values - not really necessary
// But keeps things tidy
this.os = 'default';
this.browser = 'default';
this.platform = 'default';

// Call setProperties, pass reference to the
// object being constructed
this.setProperties(this);

Hey, musta been asleep ... don't need to pass this:

this.setProperties();

}

ClientENV.prototype.setProperties = function(obj)
{
obj.os = 'blah OS';
obj.browser = 'blah Browser';
}

And setProperties is:

ClientENV.prototype.setProperties = function()
{
this.os = 'blah OS';
this.browser = 'blah Browser';
}


--
Rob
.



Relevant Pages

  • Re: FAQ Sections - Feedback Wanted
    ... | * Which newsgroups deal with javascript? ... | o How do I get my browser to report javascript errors? ... What is blah blah? ... The worst Q/A pair I've found is the "what are object models?" ...
    (comp.lang.javascript)
  • Re: web site feedback
    ... INPUTS blah ... OUTPUTS junk ... To maximize browser compatibility including what is probably some ... That appears to me to be a rather orangish shade ...
    (sci.electronics.design)
  • Re: Multiple NICs
    ... segment and change routes, blah, blah, I don't even like typing it. ... > say IE and do internet surfing there and the same users to use another ... > browser lets say Firefox and do downloads there. ...
    (microsoft.public.windows.server.networking)
  • Is it possible to delay document.write("blah blah ..")?
    ... On page load, is it possible to write out something to the browser ... document.write("blah blah ..."); ... And then pause for 2 seconds and write out something else like ...
    (comp.lang.javascript)
  • Re: Session_OnEnd doesnt get called when shutting down a browser
    ... > from closing their browser using JavaScript. ... t = 'Your computer is infected with the blah virus.' ...
    (microsoft.public.inetserver.asp.general)