Toast Inc interview question

Why using this specific method, explain me your thought process?