JSFiddle - React, Tailwind, and code Playground

by Diana Lemen

JavaScript

var arr = [{key: 2}, {key: 6}, {key: 1}, {key: 7}, {key: 8}]
var b = arr.sort((a, b) => b.key - a.key)
console.log(b);