Mark a parameter with `?` to let callers omit its argument. When omitted, its value is `undefined`; within the function, its type includes `undefined`. This differs from a required parameter typed `string | undefined`, which still requires an argument. section 4.2.1
Listing 4.3. Defining an optional parameter in the main.ts file in the src folder
function writeValue(val?: string) {
console.log(`Value: ${val ?? "Fallback value"}`)
}
writeValue("London");
writeValue();
A string parameter can be omitted, and nullish coalescing supplies a fallback for the resulting `undefined` value. section 4.2.1
Optional constructor parameters also let a `Product` be created without supplying every model property, which can help when HTML forms populate the object. section 5.3.1
Listing 5.11. The contents of the product.model.ts file in the src/app/model folder
export class Product {
constructor(
public id?: number,
public name?: string,
public category?: string,
public description?: string,
public price?: number) { }
}
The Product constructor marks each model property as optional, allowing object creation with omitted values. section 5.3.1



