I have below function in TypeScript (which i can't change the order of the parameters),
user(firstName: string, lastName?: string, address?: string); When in the case where I need to only pass firstName and address what is the better/suitable/recommended value to pass as the lastname ?
case 1: user("Jack", undefined, "NY"); or
case 2: user("Jack", null, "NY"); What are the pros and cons of each approach ?
user("Jack")is the same asuser("Jack", undefined, undefined), so why make something optional if it can't handle absent parameters.