From the course: Learning Functional Programming with JavaScript ES6+

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Anagrams

Challenge: Anagrams - JavaScript Tutorial

From the course: Learning Functional Programming with JavaScript ES6+

Start my 1-month free trial

Challenge: Anagrams

- [Instructor] The next functional programming challenge we're going to tackle in this course, is the problem of finding anagrams for a given word. Now if you don't know what anagrams are, they're two or more words that have the exact same letters and number of letters. For example, iceman, cinema, and anemic. Each of these has one a, one n, one e, one m, one I, and one c. So your challenge is to write the body of this function that takes a word as an argument, and finds all the anagrams for that words in the second argument here. This second argument will be an array of all the words in our dictionary. Now before you start this challenge, note that we're importing something up top here. This is an npm package that exports an array of all the words in the English language. So in other words, it's a really big array of strings. And before we can do anything, we have to install this package. So just open up a terminal inside your directory, and we're going to type npm, install, dash…

Contents