What does an exclamation mark before a function do?
Example:
return !loadDynamicBlock();
What is the TypeScript exclamation mark? The non-null assertion operator tells the TypeScript compiler that a value typed as optional cannot be null or undefined . For example, if we define a variable as possibly a string or undefined, the ! operator tells the compiler to ignore the possibility of it being undefined.
! is a logic reversal operator, if something was true it will change it to false, if something is false, it will change to true. example, we know that empty string or 0 in boolean is false. let a = Boolean("") console. log(a) // shows false, because empty string in boolean is false console.
The exclamation mark (non-null assertion) operator removes null and undefined from the type of an expression. It is used when we we know that a variable that TypeScript thinks could be null or undefined actually isn't.
The exclamation mark, !, or exclamation point (American English), is a punctuation mark usually used after an interjection or exclamation to indicate strong feelings or to show emphasis. The exclamation mark often marks the end of a sentence, for example: "Watch out!".
The !
in Javascript inverts a boolean expression.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With