When you use the . operator on a variable that is a primitive data type, the variable will be autoboxed, for example:
var str = "Hello World"; // str is of type string
console.log(str.length); // a temporary object of type String will be created
But does autoboxing only happen when the . operator is used?
No, it's used whenever you access a property on a primitive, which has a corresponding constructor.
E.g.
'abc'[2] // this will access 'c'
As you can see, no '.' accesor was used.