Please, can anyone help explain the difference between a string and a string literal?
“Literal” simply means that it’s the value itself, rather than a variable.
const dog = 'Santa’s Little Helper';
Santa’s Little Helper is a string literal, whereas
Ok. I am getting it. Thank you.
Refer to this aswell.
I have gone through the article. It was helpful. Thanks.
Lionel is right, that is what is meant by a “string literal”.
And Emgo-Dev is right, that there is also something called a “template literal” that relates to strings and is part of ES6, and might mistakenly be referred to as a “string literal”. They are string literals with the added feature of allowing some light templating.