Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's analogous to the difference between <code>int</code> and <code>Integer</code> in Java.</p> <p>According to the standard, strings are automatically converted to <code>String</code> objects when you try to call a method. See <a href="http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf" rel="nofollow noreferrer">ECMA 262-3 section 11.2.1</a>; step 5 calls <code>ToObject</code> (which is defined in section 9.9).</p> <blockquote> <p>11.2.1 Property Accessors <br>[...]<br> The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows:</p> <ol> <li>Evaluate MemberExpression.</li> <li>Call GetValue(Result(1)).</li> <li>Evaluate Expression.</li> <li>Call GetValue(Result(3)).</li> <li>Call ToObject(Result(2)).</li> <li>Call ToString(Result(4)).</li> <li>Return a value of type Reference whose base object is Result(5) and whose property name is Result(6).</li> </ol> </blockquote> <p><br></p> <blockquote> <p>9.9 ToObject</p> <p>The operator ToObject converts its argument to a value of type Object according to the following table: <br>[...]<br> Create a new String object whose [[value]] property is set to the value of the string. See 15.5 for a description of String objects.</p> </blockquote> <p>As a specification technique, this is a hack to explain how strings can appear to have methods even though they're not really objects.</p> <p>Apart from that, the wrapper objects are not very useful. I don't know why they're in the language. I rather wish they weren't. :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload