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

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -