This is the most basic JS object example I can think of that illustrates my questions.
Question 1.
How can I reference functions within a class so that in other code I could call a method? This gives me an error.
  var name1 = new Name();
  name1.render(); 
Question 2.
What is the difference between declaring functions in-line like this vs. using var getByID = function() ...?
Example object:
function Name(user_id, container_id) {
  this.userID = user_id;
  this.containerID = container_id;
  this.firstName = null;
  this.lastName = null;
  function getByID(userID) {
    // An ajax call that takes a userID to get a name.
  }
  function setName() {
    // An ajax call to get the name from db.
    name_record = this.getByID(this.userID); ????? this returns an error that getByID is undefined.
    this.firstName = name_record.firstName;
    this.lastName = name_record.lastName;
  }
  function render() {
    $(this.containerID).val(this.firstName + ' ' + this.lastName);
  }
}
 
     
     
    