Return result of query as variable

function GetAllSumVotes ( ) {

let SumAllVotes
return
wixData . aggregate ( “Competition” )
. sum ( “votes” )
. run ()
. then ( ( results ) => {
SumAllVotes = results . items [ 0 ]. votesSum ;
//console.log(“SumAllVotes:”,SumAllVotes)
}

            **return**  SumAllVotes ; 

}

GetAllSumVotes (). then ( z => console . log ( “SumAllVotes:” , z ));