Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://es5.github.com/#x4.3.2" rel="nofollow">Primitives</a> are not objects, everything else (<a href="http://es5.github.com/#x15-toc" rel="nofollow">any standard object</a>) is an object. However, most primitives (all apart from <code>undefined</code> and <code>null</code>) have an object counterpart.</p> <p>So </p> <pre><code>var a = false; </code></pre> <p>is not an object, but</p> <pre><code>var b = new Boolean(false); </code></pre> <p>is.</p> <p>Since two objects are only equal if they refer to one and the same object, using the object version of primitives should better be avoided:</p> <pre><code>a === false; // is true b === false // is false &lt;- this is a problem </code></pre> <p>Or especially with boolean objects, using them with any boolean operators will create unexpected results. An object reference always evaluates to <code>true</code>, so the outcome of using <code>b</code> would be:</p> <pre><code>// remember // a is the primitive value false // b is a boolean object with value false // NOT !a // true // but !b // false // AND a &amp;&amp; true // false // but b &amp;&amp; true // true </code></pre> <p>There is no real advantage of using these object versions anyway, since JavaScript is <a href="http://en.wikipedia.org/wiki/Autoboxing#Autoboxing" rel="nofollow">autoboxing</a> primitives when you try to call methods on them. That's why calls like:</p> <pre><code>var s = "HI THERE!".toLowerCase(); s = s.substring(0,2); </code></pre> <p>are possible.</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. 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