0

Possible Duplicate:
Constructors in Javascript objects

I have a simple JS object such as the following:

MyObj = {
    var: 'text',

    fn1: function(){

    },

    fn1: function(){

    }
}

Is there a default function such as _init() or _construct() that is executed when the object is initialized at runtime?

Community
  • 1
  • 1
Joe
  • 1,762
  • 9
  • 43
  • 60
  • That solution reference is not even close to what I'm asking for... There is a BIG difference between setting variables at init and executing functions at init... – Joe Oct 01 '12 at 06:59
  • And note that since Javascript is not exactly an OOP language, OOP features like constructors can be a bit awkward to replicate. You might be better off changing your code to fit the language rather than the other way around. – NullUserException Oct 01 '12 at 07:29

0 Answers0