Horje
how to add two attay into object in javascript Code Example
how to add two attay into object in javascript
var keys = ['foo', 'bar', 'baz'];
var values = [11, 22, 33]

var result =  Object.assign.apply({}, keys.map( (v, i) => ( {[v]: values[i]} ) ) );
console.log(result); //returns {"foo": 11, "bar": 22, "baz": 33}
how to add two attay into object in javascript
var keys = ['foo', 'bar', 'baz'];
var values = [11, 22, 33]

var result = {};
keys.forEach((key, i) => result[key] = values[i]);
console.log(result);




Javascript

Related
how to change url path in javascript Code Example how to change url path in javascript Code Example
how to add text to h2 with jquery Code Example how to add text to h2 with jquery Code Example
javascript import class from another file Code Example javascript import class from another file Code Example
sum of odd numbers in an array javascript without loop Code Example sum of odd numbers in an array javascript without loop Code Example
iso to  date javascript Code Example iso to date javascript Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7