I do not understand how this JS code is working; how are these two lines being returned?

let specificSuffix = function(words, suffix) {
  if (!Array.isArray(words)) {
    return [];
  }
  return words.filter(function(word){
 return word.endsWith(suffix)
  });
}

console.log(specificSuffix(['family', 'hound', 'catalyst', 'fly', 'timidly', 'bond'], 'ly'));
// [ 'family', 'fly', 'timidly' ]
console.log(specificSuffix(['simplicity', 'computer', 'felicity'], 'ily'));
// [ ]

I’m confused specifically about:

return words.filter(function(word) {
return word.endsWith(suffix)
});
}

How am I returning both of these things? The filter is saying, return this empty new array, fill it with the words that endWith the suffix… (I think)

It’s really just the two returns that are throwing me. How does this work?