JS functions for checking types