javascript - How to combine object array values into 1 array? -
I have a data object that has an object containing an Object: JS You need to reassign tags array, through a loop Would like to capture the object and each object tag and finally add the coalition, adds the value to 1 array, which is called
selections when the loop is completed. At the moment I am unable to solve it, I have tried to push the tag into an array, then use the underscore_uayan method, and also that every loop attempts to include the array in 1 but with success No. Can anyone suggest solutions?
var selection = []; Var data = ([[role: "developer", tag: "developer", tag: ["javascript", "css", "html"]}, {roll: "creator", tag: "creator", tag: ["Project Management", "Pitching", "Billing"]}]]); For (var i = 0, len = data.length; i & lt; len; i ++) {selection.concat (data [i] .tags); } Console.log (Selection);
selection And to concat that again Then use:
for
(var i = 0, len = data.length; i & lt; len; i ++) {selection = selection.concat (data [i]. Tags); }
Comments
Post a Comment