title: Checking the types of function arguments in Javascript
body: <p>In Javascript, is there any way to check the types of a function's arguments? I want to write a function called <code>checkTypes</code> that does the following:</p>
  
  <pre><code>function checkTypes(typeArr){
      //if the types do not match typeArr, throw an error
  }
  
  function exampleUsage(arr1, arr2, num1){
      checkTypes("object", "object", "number");
      //throw an error if the types do not match the corresponding elements
  }
  </code></pre>