Imagine the following situation:
I have several "classes" built from javascript functions where their properties are defined inside the constructor. So:
var Pessoa = function(data) {
this.nome = arguments[0].nome || '';
this.telefone = arguments[0].telefone || '';
... // n parâmetros ...
this.email = arguments[0].email || '';
};
The use of the arguments[0]
property is used to send an object with all the properties that will be set for this Person class. Is there any way I can return all the properties I have inside the constructor of this classe
?
As far as I understand of Javascript, I probably could not do this natively. So, using a prototyped function, how can I return all the parameters defined within my constructor?