After logging this in console
const prepareBlackTea = () => 'blackTea'; and after this
prepareBlackTea the result is
() => 'blackTea'
My question: what exactly do I get in return? Is it only a string like this
'blackTea' or it’s this piece of code
() => 'blackTea' - if it is, does it work as a function?
this is an anonymous function with arrow syntax, it also uses implicit return, it will return the string
this is a pretty simplified example of functional programming, to show the concept, it’s not a real use case
This logs the function:
console.log(prepareBlackTea) // () => 'blackTea'
This calls the function, so you log its return value:
console.log(prepareBlackTea()) // 'blackTea'
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.