I have an external client in a js file.
function client(Id,userName,code,type, firstName, SurName, address, phoneNum, Email)
{
this.Id = Id;
this.userName = userName;
this.code = code;
this.firstName=firstName;
this.SurName=SurName;
this.ddress=address;
this.phoneNum=phoneNum;
this.Email =Email;
this.clientAccounts = [];
this.addAccount = function(account)
{
this.clientAccounts.push(account);
};
}
and I have an html page. In it I have a script:
<script type="text/javascript">
var myClients =new Array();
myClients[0]= {firstName:"John", SurName: "Doe" ,Id:11,Password:1234, Address:"Some where over the rainbow", Pnumber:0523456789, Email:"[email protected]", Type: "regular"};
var account = new account(232, "young");
var deposit = new depositAccount(232, "young", 1000, 2555);
myClients[0].addAccount(deposit);
//clientAccounts.push(myClients[0]);
</script>
Each client I initialize should have multiple accounts. Now I'm not sure how do I set the account array of the client. should it be a part of the constructor(inside the parentheses)? Because right now I can't use this array or get its data (I'm trying using another js file).