Why am I only seeing output for the .forEach() method in the console and not for the other methods?

Question

Why am I only seeing output for the .forEach() method in the console and not for the other methods?

Answer

In the .forEach() example, we are explicitly using console.log() to generate output with the array values. For the .filter() and .map() examples, those methods create a new array that are assigned a variable name. We wouldn’t see anything in the console unless we used console.log() on those variable names. Similarly with .every(), the method evaluates whether all elements in an array pass a test that is defined by the provided function. In this case, we also wouldn’t see the boolean value unless we used console.log().