Q:

Access MySQL RowDataPacket after using AVG()

I'm trying to access the object created by this query:
   con.query('SELECT AVG(gold) from results', (err,result) => {
       console.log(result[0].AVG(gold))
   })

which looks like this:
[ RowDataPacket { 'AVG(gold)': 302153.6429 } ]

But I get the error
ReferenceError: gold is not defined

A:

Never mind. Using AS you can access the value in the object just fine.
   con.query('SELECT AVG(gold) AS AverageGold from results', (err,result) => {
       console.log(result[0].AverageGold)
   })

