es6 array to object keys
const arr = ['a','b','c'];
const res = arr.reduce((a,b)=> (a[b]='',a),{});
console.log(res)const subLocationTypes = (location.subLocationTypes || []).reduce((add, cur) => {
add[cur.key] = cur.value;
return add;
}, {});
Also in JavaScript:
- hover vanilla javascript
- how to get form all filed with properties in jquery
- ways to show image in react native
- js constructor object
- sweetalert2 js
- check if file exists javascript
- how to create a object in javascript
- get hours javascript
- get a element using name in jquery
- const in javascript
- array fill
- install moment in goole dev console
- how to send a command in js
- jquery toggle visibility
- js window resize listener
- javascript set header text
- how to reload the same page using javascript
- how to add data-toggle and data-target using jquery
- sum all odd fibonacci numbers
- how to change drawing tool color google map
- foreach key value javascript
- format number thousands k javascript
- chart.js y axis maximum value
- bbcode javascript html textarea