Function/Since
1.38.0noop
A function that performs no operation and returns undefined.
Returns
voidReturns undefined because the function has no return statement.
Examples
01
Basic usage
Calling noop performs no operation.
TypeScript
noop();
console.log("Done");
// Done02
As a default callback
noop can be used when a callback is optional but a function is still required.
TypeScript
const onComplete = noop;
onComplete();
// No operation03
Calling it with arguments
The function does not accept any parameters, so it should be called without arguments.
TypeScript
noop();04
No return value
The function has a void return type and contains no return statement.
TypeScript
const result = noop();
console.log(result);
// undefinedBuilt with@cyref/js·Official documentation