JSFiddle - React, Tailwind, and code Playground

by mrcatoff

JavaScript

let array_name = [
	{
  	price: 23.75
  },
  {
  	price: 65.75
  },
  {
  	price: 48.75
  },
  {
  	price: 56.75
  }
];

array_name.sort(function (a, b) {
	if (a.price == b.price) {
  	return 0;
  }
  if (a.price > b.price) {
  	return -1;
  }
  return 1;
})
console.log(array_name)