3 ms·
Why doesn't console.log `foobar` work as imagined? It gives me an array.
by Kiro 8y ago
Why doesn't console.log `foobar` work as imagined? It gives me an array.
- fahrradflucht 8y agoTry adding interpolations to your example to make sense of this. console.log`foo${123}baz` You get an array so that you later can interleaf the parts with the interpolations you get as additional arguments.
- burlesona 8y agoThat’s actually the point, when you omit the parentheses the behavior changes, instead of interpolating the string and passing that to the function, the parts of the string get passed in instead.