title: Is this Javascript function efficient?
body: <p>I have a list of nodes, which are html li elements</p>
  
  <pre><code>&lt;ul id="nodesList"&gt;
     &lt;li id="node_1"&gt;Node 1&lt;/li&gt;
     &lt;li id="node_2"&gt;Node 2&lt;/li&gt;
     &lt;li id="node_3"&gt;Node 3&lt;/li&gt;
     &lt;li id="node_4"&gt;Node 4&lt;/li&gt;
     &lt;li id="node_5"&gt;Node 5&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I have a javascript function which manages these nodes</p>
  
  <pre><code>(function (nodesManager) {
      var nodes = [];
      nodesManager.requestNode = function(id) {
          if (nodes[id]) {
              return nodes[id];
          }
  
          nodes[id] = new Node(id);
          return nodes[id];
      }
  } (window.nodesManager = window.nodesManager || {}));
  
  var Node = function(id) {
      instance = this;
  
      var node = $("#node_" + id);
  
      this.changeName = function(newValue) {
          node.text(newValue);
      };
  
      // and other nodes specific functions
  
      var _properties = null;
      this.getProperties = function () {
          if (_properties !== null)
              return _properties;
  
          var response = null;
          $.ajax({
              cache: false,
              async: false,
              type: "GET",
              url: '/Nodes/NodeProperties', // json object { "dateCreated": "10 minutes ago", "createdBy": "Mike" }
              data: { node_Id: id },
              success: function (data, textStatus) {
                  if (data.hasError) {
                      alert(data.message);
                  } else {
                      response = data;
                  }
               },
               error: function (XMLHttpRequest, textStatus, errorThrown) {
                  alert('ajax error');
               }
          });
          _properties = response;
  
          return _properties;
      };
          this.resetProperties = function () {
              _properties = null;
          };
      }
  
  
  $("#nodesList").delegate("li", "click", function() {
      var node_Id = $(this).attr("id").replace("node_", "");
  
      var newNodeName = "I am a new value";
      nodesManager.requestNode(node_Id).changeName(newNodeName);
  });
  </code></pre>
  
  <p>My question is that if having the changeName function in the Node object affects performance?</p>
  
  <p>Is it created for each node selected by user?</p>
  
  <p>Is it better to put it inside nodesManager function so it is instantiated only once? or this doesn't matter...</p>
  
  <p><strong>What is very important for me</strong></p>
  
  <pre><code>function getNodeCreatorUserName(id) {
      var properties = nodesManager.requestNode(id).getProperties();
      var userName = properties.createdBy;
  
      // do something with userName
  };
  function getNodeDateCreated(id) {
      var properties = nodesManager.requestNode(id).getProperties();
      var dateCreated = properties.dateCreated;
  
      // do something with dateCreated
  };
  
  getNodeCreatorUserName("1"); 
  getNodeDateCreated("1");     // No server side call will be made because properties are already stored in Node object
  </code></pre>