Callbacks help (does not work when callback name switching)

Curious to know why this callback consoles one way but not the other. Any reason why after I switch the callback names around on how one way works but the other does not?


Disregard what I wrote above…

Anyway, you’re trying to log error.name and error.message, so you’re expecting error to be an object with at least those two properties.

But in this case, error is the string 'Anyone here?'.

1 Like

i meant callback. i changed the title and then forgot to change the description.

Im not sure i understand though, because in the first pic everything goes through even when there is only one parameter in line 21, but then when i switch callbacks around to define different ‘name’ and ‘message’ (in red ticks above the whereIsUser((message)), it doesnt go through.

ahhhh ok. yup… thanks Colin.

(Ah, looks like you got it, posting anyway)

In the case where “undefined undefined” gets logged:

The option3 callback is defined

(error) => {
  console.log(error.name + " " + error.message);
}

And you call it with on line 16 with 'Anyone here?' (which is not an object with name or message properties)

So error.name and error.message are both undefined.