javascript - NodeJS when to use promises? -
this might little opinion based, important question.
should use promises async operations? if have api, likely, full stack of functions in there should use promises. if make business logic functions, should return promise. wonder if good, make return promise. mean, i'm calling functions inside while loop, each of them returns promise (the functions chained). slower use promises inside function? idea in stack combine promises , regular return values? need learn this, please don't close
if function (sometimes) asynchronous, needs return promise.
if function never asynchronous, there's no reason return promise, , should avoid it. keep simple , synchronous.
Comments
Post a Comment