JSFiddle - React, Tailwind, and code Playground

by Nata_Hamster

JavaScript

function compareNumeric(a, b) {
		  if (a > b) return 1;
		  if (a == b) return 0;
		  if (a < b) return -1;
	}

let per = [9.4, 9.7, 9.3, 4.5];
let perOrder = [];

perOrder = per.sort(compareNumeric);

console.log(per);
console.log(perOrder);