| 8 | 8 | * @returns {Object} |
| 9 | 9 | */ |
| 10 | 10 | export const transform = (input) => { |
| 11 | throw new Error('Remove this line and implement the function'); | |
| 11 | const result = {}; | |
| 12 | ||
| 13 | // Iterate through each score in the input | |
| 14 | for (const [score, letters] of Object.entries(input)) { | |
| 15 | // Convert score to number (it might be a string) | |
| 16 | const numericScore = parseInt(score, 10); | |
| 17 | ||
| 18 | // Iterate through each letter in the array for this score | |
| 19 | for (const letter of letters) { | |
| 20 | // Convert letter to lowercase and assign the score | |
| 21 | result[letter.toLowerCase()] = numericScore; | |
| 22 | } | |
| 23 | } | |
| 24 | ||
| 25 | return result; | |
| 12 | 26 | }; |