Skip to content

Instantly share code, notes, and snippets.

@gndx
Created May 27, 2019 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gndx/899339ac3843244632294f12cb7f74bc to your computer and use it in GitHub Desktop.
Save gndx/899339ac3843244632294f12cb7f74bc to your computer and use it in GitHub Desktop.
const products = [
{ id: "1", name: "shirt", category: "clothing" },
{ id: "2", name: "Sports Tennis", category: "accessories" },
{ id: "3", name: "Casual shoes", category: "footwear" },
{ id: "4", name: "skirt", category: "clothing" },
{ id: "5", name: "tie", category: "clothing" }
]
let nameOfProducts = [];
for (let i = 0; i < products.length; i++) {
nameOfProducts.push(products[i].name);
}
console.log(nameOfProducts); // ["shirt","Sports Tennis","Casual shoes","skirt","tie"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment