Geeksforgeeks Javascript Variable Is Undefined