1
Student
100%
Completion rate
An anagram is a word or phrase formed by rearranging the letters of a different word or phrase. For example
- restful — fluster
- Santa — Satan
- evil — live — veil
filterAnagrams.js
Implement and export as default a function that finds all anagrams of a word. The function takes the source word and the checklist (array) and returns an array of all anagrams. An empty array is returned if no anagrams are found in the list.
Examples
filterAnagrams('abba', ['aabb', 'abcd', 'bbaa', 'dada']);
// ['aabb', 'bbaa']
filterAnagrams('racer', ['crazer', 'carer', 'racar', 'caers', 'racer']);
// ['carer', 'racer']
filterAnagrams('laser', ['lazing', 'lazy', 'lacer']);
// []
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.