Problem 22: Names scores : whats going on here?

Problem 22: Names scores : whats going on here?


Tell us what’s happening:
Once again I am passing all test cases when I run the function in the console but for some reason it’s telling me that I am not passing the 1st test-case for namesScores(test1).

Is there something wrong with my solution or is FCC just bugging out?

Your code so far

function namesScores(arr) {
  arr = arr.sort()

  function nameScoreCalc(word, i){
    let sum = 0
    let score;
    let alpha = [" ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
    for (let i = 0 ; i < word.length; i++){
        sum+= alpha.indexOf(word[i].toLowerCase())
	  return sum*i

  let total = 0 
  for (let i = 0 ; i < arr.length; i++){
    total +=nameScoreCalc(arr[i], i)
  return total

// Only change code above this line
const test1 = ['THIS', 'IS', 'ONLY', 'A', 'TEST'];
const test2 = ['I', 'REPEAT', 'THIS', 'IS', 'ONLY', 'A', 'TEST'];


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

Link to the challenge:


Your solution passes for me.

Sometimes the browser “bugs out”. Try rebooting. Try clearing the browser cache. Try a different browser.