I've been trying to create a tree module in JavaScript for implementing a family tree style structure. I'm not very experienced in newer JavaScript design styles and want to make sure I am going along the right path with the code I have written so far. Can someone let me know if I am on the right track with how this is organized?var TREE = (function() {var treeList = [], //Tree container    //Constructor for Member object    Member = function(name, mother, father, children){        this.name = name || null;        this.mother = mother || null;        this.father = father || null;        this.children = children || null;    },    //Constructor for Tree object    Tree = function(name){        this.name = name || null;        this.memberList = [(new Member(root))];    };//Tree methods  Tree.prototype.addMember = function(name, mother, father, children){    this.memberList.push(new Member(name, mother, father, children));}Tree.prototype.getMemberList = function(){    return this.memberList;}return {    create : function(treeName){        treeList.push(new Tree(treeName));        return treeList[treeList.length - 1];    },    getTreeList : function(){        return treeList;    }};}());
Javascript Module Design
javascript
Looks okay to me,I would not expose function names mentioning node, but rather familyMember or member.You expose only name through addNode, but you have name, mother, father, children in the constructor of Node.Your var statement is not well indented, making the code harder to understandI am curious as to treeList, what use case do you have in mind for that?