I have a simple promise, but I wonder why in my catch method I only need to pass "console.log" and it will automatically log that error if it happens?

Does it have something to do with the fact that catch automatically gives us an error object or is it something else?
In your case, you would pass the function
console.logto the catch method.console.logmethod just prints each parameter in the console. Inside the catch method, the passed function will be executed on a reject/error of the promise.Here is an example of passing functions:
In this case, the
console.logfunction is available asmethodin theafunction as it has been passed as a parameter. This is the reason, the code printsHello Worldin the console.