Skip to content
Advertisement

how to create a table with a concatenated array

Currently i have a btn which calls a function as follows:

JavaScript

this gets information from a bunch of arrays as follows:

JavaScript

when the button is clicked it returns [Object, object] back to the “resultsDiv”.I have researched how to put this either in a list / table with the concatinated results but the only thing i find is JSON.stringify() and that gives me a bunch of nonsense! Is there a reason for this or am i missing something? i primarily want to display the results in a table / list

my desired results are something as follows:

JavaScript

Any help is greatly appreciated!

Advertisement

Answer

Something you can do is after creating the object with the name of the ingredient and the quantity, it is creating a new loop going through all the objects and creating the tr and td

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