function addUser() {
  //Just a string value
  let firstName = $.trim($('#firstNameInput').val());
  let lastName = $.trim($('#lastNameInput').val());

  if (firstName.length > 0 && lastName.length > 0) {
    //exports new user to object in a string
    //Returns as string
    let user = new window.exports.UserInfo(-1, firstName, lastName);
    //turn into json to be used later
    let json = JSON.parse(user.toJSON())

    //Send HTTP request to change server to update user
    $.ajax({
      //Send in a string accross to API
      type: 'POST',
      url: '/addUser',
      data: JSON.stringify(json),
      //If successful sending to sever change the id to myID rather than -1
      success: function (data) {
        myId = data.id;
      },
      contentType: "application/json",
      dataType: 'json'
    });
  }
}
/**
 * @function addUser - If user enters the game. Add their name to the list of user
 */
@function addUser - If user enters the game. Add their name to the list of user
@function addUser - If user enters the game . Add their name to the list of user
function addUser() {
  let firstName = $.trim($('#firstNameInput').val());
  let lastName = $.trim($('#lastNameInput').val());
  if (firstName.length > 0 && lastName.length > 0) {
    let user = new window.exports.UserInfo(-1, firstName, lastName);
    let json = JSON.parse(user.toJSON())
    $.ajax({
      type: 'POST',
      url: '/addUser',
      data: JSON.stringify(json),
      success: function (data) {
        myId = data.id;
      },
      contentType: "application/json",
      dataType: 'json'
    });
  }
}
function addUser ( ) { let firstName = $ . trim ( $ ( '#firstNameInput' ) . val ( ) ) ; let lastName = $ . trim ( $ ( '#lastNameInput' ) . val ( ) ) ; if ( firstName . length > 0 && lastName . length > 0 ) { let user = new window . exports . UserInfo ( - 1 , firstName , lastName ) ; let json = JSON . parse ( user . toJSON ( ) ) $ . ajax ( { type : 'POST' , url : '/addUser' , data : JSON . stringify ( json ) , success : function ( data ) { myId = data . id ; } , contentType : "application/json" , dataType : 'json' } ) ; } }
@function addUser - If user enters the game.
@function addUser - If user enters the game .
//Just a string value //exports new user to object in a string //Returns as string //turn into json to be used later //Send HTTP request to change server to update user //Send in a string accross to API //If successful sending to sever change the id to myID rather than -1