How to access a RowDataPacket object

前端 未结 14 2417
悲&欢浪女
悲&欢浪女 2020-11-29 03:02

I\'m currently developing a desktop application with Node-webkit. During that process I need to get some data from a local MySQL-database.

The querying works fine, b

14条回答
  •  执念已碎
    2020-11-29 03:06

    Simpler way:

    .then( resp=> {
      let resultFromDb= Object.values(resp)[0]
      console.log(resultFromDb)
    }
    

    In my example I received an object in response. When I use Object.values I have the value of the property as a response, however it comes inside an array, using [0] access the first index of this array, now i have the value to use it where I need it.

提交回复
热议问题