Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Values</strong> are immutable; <strong>variables</strong> are not; they hold a reference to their (primitive) values.</p> <p>The three primitive types <em>string, number and boolean</em> have corresponding types whose instances are objects: <em>String, Number, Boolean</em>.<br> They are sometimes called <em><a href="https://developer.mozilla.org/en-US/docs/Glossary/Primitive" rel="noreferrer">wrapper types</a></em>. </p> <p>The following values are <a href="https://developer.mozilla.org/en-US/docs/Glossary/Primitive" rel="noreferrer">primitive</a>: </p> <ul> <li>Strings: "hello"</li> <li>Numbers: 6, 3.14 (all numbers in JavaScript are floating point)</li> <li>Booleans: true, false</li> <li>null: usually explicitly assigned</li> <li>undefined: usually the default (automatically assigned) value</li> </ul> <p>All other values are objects, including wrappers for primitives. </p> <p>So:</p> <ul> <li>Objects are mutable by default</li> <li>Objects have unique identities and are compared by reference</li> <li>Variables hold references to objects</li> <li>Primitives are immutable</li> <li>Primitives are compared by value, they don’t have individual identities</li> </ul> <p>You might find <a href="http://javascriptweblog.wordpress.com/2010/09/27/the-secret-life-of-javascript-primitives/" rel="noreferrer">The Secret Life of JavaScript Primitives</a> a good explanation.</p> <p>Also, in ES6 there is a new <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/const" rel="noreferrer">const</a> keyword, that creates a read-only named constant that cannot change value through assignment or be re-declared while the script is running.</p> <p>Hope this helps!</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