Is there a way to let a javascript function know that a certain parameter is of a certain type?
Being able to do something like this would be perfect:
Not in javascript it self but using Google Closure Compiler's advanced mode you can do that:
/** * @param {Date} myDate The date * @param {string} myString The string */ function myFunction(myDate, myString) { //do stuff }
See http://code.google.com/closure/compiler/docs/js-for-compiler.html