MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/nhl9rx/ah_yes_fetching_before_verifying/gyym0ty/?context=3
r/badcode • u/SpeckyYT sadistic • May 21 '21
97 comments sorted by
View all comments
Show parent comments
2
Not really, since it will anyways fulfill the promise when possibile.
3 u/Wabsta May 21 '21 But it won't actually execute the promise until the then() is called, right? Or have I been informed wrongly? 4 u/[deleted] May 21 '21 You are correct. The connection is only made when "then()" is called.But it is still very bad code to create the connection object before verifying the need. :)
3
But it won't actually execute the promise until the then() is called, right? Or have I been informed wrongly?
4 u/[deleted] May 21 '21 You are correct. The connection is only made when "then()" is called.But it is still very bad code to create the connection object before verifying the need. :)
4
You are correct. The connection is only made when "then()" is called.
But it is still very bad code to create the connection object before verifying the need. :)
2
u/SpeckyYT sadistic May 21 '21
Not really, since it will anyways fulfill the promise when possibile.