typescript "variable!: type" notation
// Writing ! after any expression is effectively a type assertion
// that the value isn’t null or undefined
function liveDangerously(x?: number | null) { // No error console.log(x!.toFixed());}Try
typescript "variable!: type" notation
// Writing ! after any expression is effectively a type assertion
// that the value isn’t null or undefined
function liveDangerously(x?: number | null) { // No error console.log(x!.toFixed());}Try
typescript "variable?: type" notation
// the "last" property is optional and can be undefined
function printName(obj: { first: string; last?: string }) { // ...}// Both OKprintName({ first: "Bob" });printName({ first: "Alice", last: "Alisson" });Try
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us