this is quite an easy question but is not obvious to me.
What is the difference between this:
function fesElsDeures(subject){
console.log(`just started doing my ${subject} `);
}
and this:
function fesElsDeures(subject){
console.log("just started doing my ${subject} ");
}
It seems that in the second option, my console does not recognise the subject as a different value.
Thanks!
Double quotes or single qoutes are just indicating string. But in first example there are not single quotes. It's a back-tick (`
`
) and it allows you to use embedded expression( in this case 'subject' parameter of your function).
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
Don't to be confuse with ' (Single quote) with ` (back-tick).
when you use back-tick, it allows you write multi line texts. Template literals
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