Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var arr = [ [ 'cardType', 'iDEBIT' ],
- [ 'txnAmount', '17.64' ],
- [ 'txnId', '20181' ],
- [ 'txnType', 'Purchase' ],
- [ 'txnDate', '2015/08/13 21:50:04' ],
- [ 'respCode', '0' ],
- [ 'isoCode', '0' ],
- [ 'authCode', '' ],
- [ 'acquirerInvoice', '0' ],
- [ 'message', '' ],
- [ 'isComplete', 'true' ],
- [ 'isTimeout', 'false' ] ]
- var obj = Object.assign(...arr.map(([key, val]) => ({[key]: val})))
- console.log(obj)
- /*
- acquirerInvoice: "0"
- authCode: ""
- cardType: "iDEBIT"
- isComplete: "true"
- isTimeout: "false"
- isoCode: "0"
- message: ""
- respCode: "0"
- txnAmount: "17.64"
- txnDate: "2015/08/13 21:50:04"
- txnId: "20181"
- txnType: "Purchase"
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement