JSFiddle - React, Tailwind, and code Playground
by Jessie Lau
JavaScript
function ThirdGreatest(strArr) {
var words = [];
var WordLengthy = 0;
var currentWord = "";
var currentWordLengthy = 0;
for (var i = 0; i < strArr.length; i++) {
currentWordLengthy = strArr[i].length;
if (WordLengthy < currentWordLengthy) {
WordLengthy = currentWordLengthy;
words.push(currentWord);
}
}
reutrn words;
}
console.log(ThirdGreatest(["coder", "byte", "code"]));