Developers can use the optional parameter to declare parameters in function optional so that the requirement to pass the value to optional parameters gets eliminated. We have to use “?” at the end of a parameter to mark it optional as just shown below.

function functionName(par1: number, par2?: number) {
}

Here par2 is an optional parameter.

Suggest An Answer

No suggestions avaliable!