I can't understand what $scope.search is doing there, like, what it is doing when it set equals to the function? And, if i want to do in other way, how should i do?
(i am using angular js, 1.6 version)
 $scope.search = function(){
                    query.get($scope.username , {
                        success: function(gameScore) {
                            console.log(gameScore);
                            return gameScore;
                        },
                        error: function(object, error) {
                            console.log("Sorry, this user does not exist yet");
                        }
                    });
                };
 
     
    