From the course: JavaScript: Test-Driven Development (ES6)

Unlock the full course today

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

Challenge: Given criteria, write unit tests

Challenge: Given criteria, write unit tests - JavaScript Tutorial

From the course: JavaScript: Test-Driven Development (ES6)

Start my 1-month free trial

Challenge: Given criteria, write unit tests

- [Instructor] Now that we've gone through an example of the basic TDD cycle, let's do a challenge. The challenge here, to give you a little independent practice with doing the TDD cycle, is this. I'm going to give you a description of a problem and your job is to use TDD to write some code that fulfills the criteria. So, before I tell you about the challenge, let's create two more files in our source directory, here. The first one, which will hold the production code, we'll call anagrams.js, and the second one, which will hold the test code, we'll call anagrams.test.js. So here's the task. You're going to write a function that accepts two strings and tells you whether the two strings are anagrams of each other. An anagram is when you have two strings that have the exact same letters in them and the exact same quantities but in a different order. For example, the words listen and silent or elbow and below. Simple enough…

Contents