JSFiddle - React, Tailwind, and code Playground
JavaScript
var words = ["catt", "battt", "mat"];
console.log(
words.sort(function(a, b) { return a.length > b.length; })
);
var words = ["catt", "battt", "mat"];
console.log(
words.sort(function(a, b) { return a.length > b.length; })
);