Skip to content

Instantly share code, notes, and snippets.

@carlrip
Created December 17, 2019 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlrip/18d050c168e2e1af5b4ad50ff7b0f573 to your computer and use it in GitHub Desktop.
Save carlrip/18d050c168e2e1af5b4ad50ff7b0f573 to your computer and use it in GitHub Desktop.
Nullish coalescing
function getPersonScore(id: number): number {
const person: Person = getPerson(id);
return person.score ?? 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment