DEV Community

loading...

Discussion on: 5 ways to refactor if/else statements in JS functions

Collapse
rasmusvhansen profile image
rasmusvhansen

I am not sure turning inherently synchronous code into async is a good idea. Promises are OK (not great - observables are better in many cases) for async operations but I would definitely avoid introducing the complexity for inherently sync operations.

By using this pattern, you are forcing all your code to be async.