I have a little misunderstanding in JavaScript string type.
According to JavaScript: The Definitive Guide, by David Flanagan,
Any JavaScript value that is not a number, a string, a boolean, or
null
orundefined
is an object. An object (that is, a member of the type object) is a collection of properties where each property has a name and a value
Let's take an example:
var t = "some text";
t.length // give me the length of t
How is it possible? I know that JavaScript strings are primitive values (like numbers), so how is it possible for a primitive value to have a property (like object)?