Toast Inc Interview Question

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