highest-scoring

Run Settings
LanguageJavaScript
Language Version
Run Command
function high(x){ let arr=x.split(' ') let sumArr=[] for(let i=0; i<arr.length; i++){ let word=arr[i].split('') let sum=0 for(let j=0; j<word.length; j++){ sum=sum + (word[j].charCodeAt(0)-96) } sumArr.push(sum) } let index = sumArr.indexOf(Math.max(...sumArr)) return arr[index] } console.log(high("man i need a taxi up to ubud")) console.log(high("what time are we climbing up the volcano")) console.log(high("take me to semynak")) console.log(high("aa b")) console.log(high("b aa"))
Editor Settings
Theme
Key bindings
Full width
Lines