created console and alert for if