title: Explicit type casting in js
body: <p>Is there a generic way to explicitly cast a variable to a specific type?
  For example: </p>
  
  <pre><code>var b = true;
  var str = "";
  var n = 5;
  cast(someVariable, typeof b);   //someVariable become a boolean
  cast(someVariable, typeof str); //someVariable become a string
  cast(someVariable, typeof n);   //someVariable become an integer
  </code></pre>
  
  <p>where a <code>cast</code> is supposed to be that magic casting method.</p>
  
  <p>That's obvious that I can just enumerate in a <code>switch</code> all possible types. But is there a [beautiful] native way to do that? </p>