I thought this MDN page was an exhaustive list of literals. I was then told function expressions were also literals (something the MDN page didn't mention).
My current understanding of all the literals in JavaScript is:
string literals ("str"|'str'); template literals; numeric literals i.e. 5; boolean literals i.e. true; null literal; array literals ([1, 2]) and object literals ({num: 5}).
Same to a previous question I asked, I'm wondering why:
The primitive value
undefined
is not a literal.The purpose of the term 'literal'. Why have we created this term?
i) This article says: a literal is
something that has a fixed value that was set by a programmer during the creation of the code.
ii) And this article contrasts literals with variables saying variables are often initialised by literals.
I'm just left wondering why the primitive undefined
is not a literal since i) it seems like a fixed value and ii) it can initialise a variable