javascript loop over three-dimensional array
var items = [[['firstName', 'Joe'], ['lastName', 'Blow'], ['age', 42], ['role', 'clerk']], [['firstName', 'Mary'], ['lastName', 'Jenkins'], ['age', 36], ['role', 'manager']]];
var result = [];
// first loop through items
items.forEach(function(item)
{
var obj = {};
// then loop through properties
item.forEach(function (value)
{
// then set property and value
obj[value[0]] = value[1];
});
// once all is done push the object
result.push(obj);
});
console.log(result);
Also in JavaScript:
- starting with react router dom
- jQuery - Get Content and Attributes
- javascript check if dom element exists
- vue watch deep property
- codemirror get value
- for loop javascript
- como checar valor do input checkbox angular
- sleep function js
- js window redirect
- Image react native
- import npm module node.js
- npm update package.json version field by code
- change title react
- select the items from selectors in .map reactjs
- Property 'find' does not exist on type NodeListOf
- media queries generator script
- filter in react native
- javascript change select options dynamically
- js map don't return
- multi-dimensional array js
- javascript remove duplicate letters in a string
- uncheck checkbox when another is checked javascript
- post fetch call
- javascript get stack trace