Lodash fromPairs method
语法:
The inverse of _.toPairs; this method returns an object composed from key-value pairs.
参数
pairs (Array) − The key-value pairs.
输出:
(Object) − Returns the new object.
实例:
var _ = require('lodash');
var list = [['One' , 1], ['Two', 2]];
var result = _.fromPairs(list)
console.log(result);
Save the above program in
tester.js. Run the following command to execute this program.
命令:
输出: