I've got a situation in which i need to create objects with parameters
passed to me as Array.
Currently i do this, in this way:
---
function initObj(params){ // params is Array
   var  o = $merge({}, new MyClass());
   o.initialize.run(params, o);
}
---
This solution has one issue, it required me to check for empty
arguments list in the constructor.

---
initialize: function(p1, p2, p2){
   if (arguments.length == 0) {
      return;
   }
   // the rest of the code
}
---

There is a better way to do this?

Thanks, Nir.

Reply via email to