DEV Community

Discussion on: HTTP request with ES6 tagged templates

Collapse
 
kayis profile image
K

Nice.

A few years ago I read somebody talking about the fact that templates can be used as an alternative function syntax. I found this quite funny. Why would anyone do this to save two characters?

It turns out, many things in JavaScript are already done with strings and the fact that these are string templates and not just plain strings makes them rather powerful and with Babel plugins they can be converted to regular function calls before hitting production.

Collapse
 
kayis profile image
K • Edited

I started a awesome list for this kind of stuff, maybe this will become more of a thing in the future :D

awesome-tagged-templates

Collapse
 
herrfugbaum profile image
Pascal

Jest is using this in each

See point 2:
jestjs.io/docs/en/api#testeachtabl...