0

Whenever we declare

var item = "string";

It means we are creating a string variable but surely a string object is made in background so that we can access

item.length;

It means item has reference to some object so we can access it's property.

It is confusing because item.length tempts me to consider item as a reference to an object but if we log it on console it just prints it value.

Someone please can help me?

ddb
  • 2,423
  • 7
  • 28
  • 38
  • please, what's the question? do you want to understand why we can manage item as an object but it's not an object? – ddb Jul 11 '16 at 15:36
  • Yes exactly....it is a variable....but how come we can use it as an object to reference string object properties like length –  Jul 11 '16 at 19:02

0 Answers0