JSFiddle - React, Tailwind, and code Playground

by alexjamesbrown

JavaScript

var products = [{
    id: 1,
    name: "Product One"},
{
    id: 2,
    name: "Product Two"},
{
    id: 5,
    name: "Another Product"}
];

var productIds = products.map(function(product) {
    return product.id
}).toString();

//out
document.write(productIds);