// Functions inside expressionsfunctionfunc(){return“Iamtheresultoffoo”}console.log(`bar ${func} baz.`);// => bar function func() { return "I am the result of foo" } bazconsole.log(`bar ${func()} baz.`);// => bar I am the result of foo baz
I was thinking from your example that javascript does something clever to understand that a function is callable, but it doesn't - instead it returns the entire function definition as a string.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
That's not what I get when using the second one:
I was thinking from your example that javascript does something clever to understand that a function is callable, but it doesn't - instead it returns the entire function definition as a string.