Mot de score le plus élevé

/*
Given a string of words, you need to find the highest scoring word.
Each letter of a word scores points according to its position in the 
	alphabet: a = 1, b = 2, c = 3 etc.
You need to return the highest scoring word as a string.
If two words score the same, return the word that appears earliest in the 
	original string.
All letters will be lowercase and all inputs will be valid.
*/

const high = x => {
  let word = []
  let scores = []
  
  x.split(" ").forEach(letter => {
    word.push(letter)
    let score = letter.split("")
    .map(alphabet => alphabet.charCodeAt(0) & 31)
    .reduce((acc, cur) => acc + cur, 0)
    scores.push(score)
  })
  
  const index = scores.indexOf(Math.max(...scores))
  return word[index]

}

// With love @kouqhar
kouqhar