title: Type casting in JavaScript
body: <p><strong>Example:</strong></p>
  
  <pre><code>function action(value) {
       // I want to operate on a string
       String(value)...;
  }
  </code></pre>
  
  <p>When we pass dynamic values into JavaScript's primary types (<code>String</code>, <code>Number</code>, <code>Boolean</code>, <code>Object</code>, etc.) we can (for want of a better word) cast the value to the specified type.</p>
  
  <p>Is it possible to build this feature in custom types, and how would I go about this?</p>
  
  <p><strong>Example of what I would like to do:</strong></p>
  
  <pre><code>function action(value) {
      Point(value)...;
      // Value at this point (excuse the pun) is a point
      // // *** Would like to see that intellisense is aware of the type at this point, but please don't assume this is ONLY for intellisense***
  }
  </code></pre>
  
  <p>Is it possible to call constructor functions in this way and have the constructor function "cast" the value to an instance of itself - or does this only work for JavaScript's primary types?</p>