Skip to content
Advertisement

Tag: callback

Returning result from asynchronous function using callbacks

I have to write the body of a function getABC() which essentially has to take in responses from 3 different functions, getA()(synchronous),getB(callback)(callback driven),getC() (promise based). Ultimately I have to return a promise aggregating each function’s result, like [(result of getA),(result of getB),(result of getC)]. I am pasting the snippet of the code down below: ` I cannot edit any other

Function parameter is not defined in callback

I am trying to get the location of the user and using that I am trying to get the city. I don’t why but when I call the query function, the city parameter is having some value but it is not reflected in the callback function’s if condition. However, if I replace the city variable in the If condition with

What is the lexical environment inside a callback function?

I keep hearing that arrow functions inherit the value of this from their Lexical Environment. Consider this example: Why is the value of this inside the arrow callback functions undefined (or in non-strict mode: window)? If the callback function is using the value of this from its lexical environment, shouldn’t the lexical environment be addEventListener? Answer When you call a

Callback error when calling endpoint function

I’ve received an Node.js api documented with swagger for debbuging. I also have to make some features in it, but I’m having some trouble when calling, in the code, the functions executed when you hit an specific endpoint. To make my self clear: Works fine from Swagger UI when I only give it the argument of the ID required in

Advertisement