use type of to check if undefined