updated functions 1, 2, 3 with local variables and if else with console log