function that return shortest of words in the given array js code example
Example: function that return shortest of words in the given array js
words = ["one", "two", "three"];
function getShortestWord(wordsArray) {
return wordsArray.sort((a, b) => a.length - b.length)[0];
}
console.log(getShortestWord(words));