What does ‘scalar’ even mean?
According to Merriam-Webster:
Definition of scalar (adjective) 1: having an uninterrupted series of steps. 2: capable of being represented by a point on a scale
It accurate for us to think of scalar as a point on a scale (or point of data). In simpler terms, scalar means a single value.
- Arrays and Objects are not scalar as they are comprised of multiple values/units of data. These are known as compound values.
- Scalar primitives are always assigned and passed by value-copy, not by referrence.
- Our “primitive” values are really the same as scalar primitives as they are single units of data that are immutable. Scalar is simply an add-on adjective that helps to describe the intended behavior of these values.
Scalar Primitive Values
- Number (including BigInt)
- Symbol (ES6)
Primimtives vs. Natives
One last mention that may clear up some confusion is to discuss the distinction between ‘primitives’ and ‘natives’. I suggest reading Ch. 3 within Types & Grammer - You Don’t Know JS to go in-depth on natives and primitives.
Cover Photo Credit: Artem Sapegin