Difference between the javascript String Type and String Object?
<p>I've been messing around with the ECMA-262 standard <em>(ECMAScript Language Specification, 3rd edition, if it matters for this - I have not found any difference between the 3rd and 5h edition on String Type / String Object)</em>.</p>

<p>There's one thing that baffles me, the difference between the String Type and the String Object, yes I know the difference in the sense that the <em>String Type</em> is a sequence of 16 bit UTF-16 units and the <em>String Object</em> is a built in object with its internal <em>Class</em> property set to "String" and its internal <em>Value</em> property set to a value of the <em>String Type</em>.</p>

<p>But reading the specification, the string type does not seem to expose any methods, aka. it's just a value without any additional properties. Take this code, everything is exactly as expected:</p>

<pre><code>document.writeln(typeof "foo"); // 'string'
document.writeln(typeof new String("foo")); // 'object'
</code></pre>

<p>The first type of the actual <em>String Type</em> and the second is the <em>Object Type</em> (it's an object of class <em>String</em>, but it's data type is object). However, looking at this:</p>

<pre><code>"foo".charAt(0);

fooStrObj = new String("Foo");
fooStrObj.charAt(0);
</code></pre>

<p>They both seem to expose the same functions, but there are no functions on the <em>String Type</em> defined in the ECMA-262 standard, all the functions it exposes are from the String.prototype object (and I can see no reference to the fact that the <em>String Type</em> magically exposes all the properties and functions of the String.prototype object in the ECMA-262 standard). So are the values of type <em>String Type</em> automatically promoted to a <em>String Object</em> with the original <em>String Type</em> value as it's internal <em>Value</em> property?</p>

<p>And if they are treated exactly the same (which for all intents and purposes they seem to be) why do two different ways to represent a <em>String</em>.</p>
