function practice for javascript