JavaScript: Scrabble

Last update: 14 Sep 06:31
1
Student
100%
Completion rate

scrabble.js

Implement and export as default a predicate function that takes two parameters: a lowercase character set (a string) and a word, and checks whether the given set can be used to compose the word. As a result, the function returns true or false.

It checks for the number of characters needed to compose a word and is not case sensitive.

Examples

scrabble('rkqodlw', 'world'); // true
scrabble('avj', 'java'); // false
scrabble('avjafff', 'java'); // true
scrabble('', 'hexlet'); // false
scrabble('scriptingjava', 'JavaScript'); // true

For full access to the challenge you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests