A short example of how to do dynamic type checking in JavaScript