You're getting undefined after each of these because the function call has no return value.