Subsequence explainer

Aim of the puzzle: Create a function that determines if a string is a subsequence of an object mapped from a separate string.
Walk through of solution: The isSubsequence() function will serve as a helper function for a function you will write in the last puzzle in this course. For a step by step walkthrough of the solution, take a look at the lesson preceding this puzzle, ‘Updating the Word Search’.

isSubsequence() will take a string and a mapped object, and return true or false depending whether the string is a subsequence of the mapped object.

Let’s look at an example that checks the string 'boon' against a mapped form of the string 'balloon':

let word = 'boon';
let mappedObject = {
  b: [0],
  a: [1],
  l: [2, 3],
  o: [4, 5],
  n: [6]
}
isSubsequence(word, mappedObject)

This should return true, because ‘boon’ is a subsequence of ‘balloon’. All of the letters in ‘boon’ appear in balloon, and are in the same order.

This puzzle may be the trickiest one in the course! Leave any questions you have below, along with screenshots of your code, and our staff can help walk you through to the solution.

Again, also take a look at the lesson preceding this puzzle, which will break down the function step by step.

Good luck, Grasshoppers!