JavaScript step by step | beginner friendly solution
\n/**\n * @param {string} s\n * @return {string}\n */\nvar greatestLetter = function(s) {\n    let set = new Set();\n    for(let i=0; i<s.length; i++) {\n      
```\n/**\n * @param {string} s\n * @return {string}\n */\nvar greatestLetter = function(s) {\n    let set = new Set();\n    for(let i=0; i<s.length; i++) {\n        set.add(s[i]);\n    }\n    let incubation_arr = Array.from(set).sort().reverse();\n    \n    let res = _.compact(incubation_arr.map((el, i)=> {\n        if(incubation_arr.includes(el.toUpperCase()) && incubation_arr.includes(el.toLowerCase())){\n            return el.toUpperCase();\n        }\n    }))[0];\n    return res ? res : "";\n};\n```
['JavaScript']