JSFiddle - React, Tailwind, and code Playground

by ira kantsurova

HTML

<p></p>
<table id="myTable"></table>

JavaScript

var catalogue = {
    jewelry: [{
        type: "Bracelet",
        material: ["Stainless Steel", "Silver", "Gold"],
        size: ["6", "7", "8"]
    }, {
        type: "Necklace",
        material: ["Stainless Steel", "Silver", "Gold"],
        size: ["20", "24"]
    }]
};



var pcatalogue = $.map(catalogue || [], function (catalogueF) {
    return {
        type: catalogueF.type,
        material: catalogueF.material,
        size: catalogueF.size
    };
});



/*$.each(pcatalogue.jewelry, function () {
    $('#myTable > tbody').append(
        '<tr><td>' + this.type + '</td><td>' + this.material + '</td></tr>');
});
*/

for (var i = 0; i < pcatalogue.length; i++) {
    var jewelry = pcatalogue[i];
    for (var property in jewelry) {
        if (jewelry.hasOwnProperty(property)) {

            $("p").after(property + " = " + property[i] + "<br />");
        }
    }
}



//console.log(catalogue);