Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140500

Confusion with how thenable callback works in Promise?

$
0
0

I am new to JS and was learning promises. The code excerpt I want to show is this

promisedFunction.then(data=>console.log(data))

or simply

promisedFunction.then(console.log)

which is equivalent of the former code excerpt. The question is how is that possible to just use then(console.log) instead of then(data=>console.log(data))? Does it mean that we can omit the passed-from-promise data in thenable callback?


Viewing all articles
Browse latest Browse all 140500

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>