A function in JS can be called in the very strange way:
[1,2,3].join``
-> "123"
Could somebody explain how it works "under the hood" or provide a link to some explanations?
Tagged template literals call the function that precedes them, which in this case is join
It seems you are referring tagged templates which allow you to parse template literals with a function & first argument of a tag function is related to the expression. Here join is the tag function
console.log([1,2,3].join`,`)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With