Guest User

Untitled

a guest
Oct 15th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. const objArr = [
  2. { k: 'row 1', v: '111' },
  3. { k: 'row 2', v: '222' },
  4. { k: 'row 3', v: null },
  5. { k: 'row 4', v: null },
  6. ];
  7.  
  8. let obj = {};
  9.  
  10. objArr.forEach(function(x, i) {
  11. obj[x[Object.keys(x)[0]]] = x[Object.keys(x)[1]]
  12. });
  13.  
  14. console.log(obj);
Add Comment
Please, Sign In to add comment