Testing the results returned from a function

Um, but you can also have an array with different types and you can give the indexes meaningful names too.

Yes, arrays are often used for multiple occurrences of the same thing, but arrays can also hold multiple occurrences of the same thing and in those “things”, there are different types, which is also often the case.

In this case, the array wouldn’t be holding multiple occurrences of the same thing. It would just be holding only one occurrence of different things, which is ok to do.

Objects, on the other hand, are usually a mix between data AND behavior, so just giving an object data and no behavior, is sort of overkill for the simple purpose of passing values out of a function.

In general though, it would probably be a better idea to have a HighlightWords class and do the work that way, but I think busboy isn’t doing OOP at all here, so introducing an object wouldn’t be quite right either, when sticking to the functional paradigm.

I also found this interesting SE question and pretty good answer. From that answer, an array will do fine here. :smile:

Scott