← Back to challenges

Scrabble Scores (Part 1)

JavaScriptHardgamessorting

Instructions

Create a function that takes an array of words, scores the words based on the Scrabble scoring table below, and returns an array of the highest scoring words. The words on the resulting array should be in the same relative order as the original array.

LetterPoints
A1
B3
C3
D2
E1
F4
G2
H4
I1
J8
K5
L2
M3
N1
O1
P3
Q10
R1
S1
T1
U1
V4
W4
X8
Y4
Z10

Examples

bestWords(["got", "test", "oh", "sat", "rents"]) ➞ ["oh", "rents"]

bestWords(["digest", "divest", "verge", "honey", "money"]) ➞ ["honey"]

bestWords(["berry", "whiz", "laughed", "ghetto", "psychic"]) ➞ ["whiz", "psychic"]

Notes

Input and output should both be arrays (see tests).

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.