Difficulty: 3/10optional parameters, default values, function overloadsIn TypeScript, every parameter is assumed to be required by the function. You can add a ? at the end of a parameter name to set it as optional.Optional parameters must come after all non-optional parameters:CopyScenario Questions0-2 years experience1We have a utility function formatDate(date: Date, format?: string). How would you implement it so callers can omit the format and get a default pattern?2If you add a boolean flag?: boolean to a function, what does the compiled JavaScript look like for calls that omit that argument?3What happens if you declare an optional parameter before a required one, and why does TypeScript warn about it?2-5 years experienceFollow-up QuestionsWhat problems arise if an optional parameter is placed before a required one?How does TypeScript emit code for a parameter with a default value versus a purely optional parameter?When would you choose an options object over several optional positional parameters?Suggest Improvement