Q:

Why prototype function returns nothing in javascript? 

My javascript prototype function like below;
ServerDataEngine.prototype. ExecuteCommand = function(command)
{
  try 
    {
       var result;
       $.get(command, function (data) {
           result = jQuery.parseJSON(atob(data));
           console.log(result);
       });
       return result;
    }
  catch (Exception) 
    {
       throw (new Exception("Can not connect to server"));
    }
}

And I call this function like this;
ServerDataEngine.prototype. ExecuteQuery = function (query) 
  {
     console.log(this. ExecuteCommand(query));
  }

In ExecuteCommand, everything is ok, but in ExecuteQuery, console.log(this. ExecuteCommand(command)) line produces undefined. 
What is the problem? 

A:

You are treating an Asynchronous Request as a synchronous one.  You are returning the value before the Ajax call ever returns a value.  It is not going to be able to work that way. 