194915/what-is-the-question-mark-for-in-a-typescript-parameter-name
export class Thread { id: string; lastMessage: Message; name: string; avatarSrc: string; constructor(id?: string, name?: string, avatarSrc?: string) { this.id = id || uuid(); this.name = name; this.avatarSrc = avatarSrc; } }
In id? what's the? for?
It is to mark the parameter as optional.
I have a small problem, but big ...READ MORE
All you have to do is define ...READ MORE
The exclamation mark is called the non-null ...READ MORE
TypeScript is a superset of JavaScript which primarily ...READ MORE
You still need to instantiate it first. ...READ MORE
Hey @Sid, do check if this link ...READ MORE
Due to the existence of a version ...READ MORE
In order to rectify this error, you ...READ MORE
The big news this week is the ...READ MORE
Typically, packages in Definitely Typed aren't official ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.