Can I build object on the fly using deconsturct?
Like I token
is under this.request.body.token
,
how can I get the value and assign it to a object property? Tried below example it won't work:
const params = {
token
} = this.request.body
console.log(params.token) //undefined
I have to do this
const reqBody = this.request.body
const params = {
token: reqBody.token
}
console.log(params.token) //123