Skip to content
Advertisement

Add array to Object

I have a collection of inputs

JavaScript

I’m trying to loop through all of these inputs to create an object with keys exactly the same as names in my inputs and add those values as values. So my steps are:

JavaScript

EDITED the expected output should look like this:

JavaScript

Advertisement

Answer

You can iterate over the input elements in chunks of 4.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement