Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Arvin iuunhao
Added: Jun 18, 2018 8:30 AM
Views: 7
Tags: js
对象转化为键值对
  1. const objectToPairs = obj => Object.keys(obj).map(k => [k, obj[k]]);
  2. // objectToPairs({a: 1, b: 2}) -> [['a',1],['b',2]])