Skip to content

Instantly share code, notes, and snippets.

Created September 2, 2017 09:24
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 anonymous/320895d9ae51c20d84b832f6be74d2fe to your computer and use it in GitHub Desktop.
Save anonymous/320895d9ae51c20d84b832f6be74d2fe to your computer and use it in GitHub Desktop.
sorting string Objects
const product = [
{
id:1,
title: "Yellow Pail"
},
{
id:2,
title: "Supermajority"
},
{
id:3,
title: "Beast vs Bananas"
},
{
id:4,
title: "Tinfoild"
},
{
id:6,
title: "Animals of Tin"
},
{
id:5,
title: "Haught or Naught"
}
]
product.sort(function(a, b) {
return a.title > b.title ;
});
console.log(product.title);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment