How to write code for no operation with JavaScript?

Sometimes, we want to write code for no operation with JavaScript.

In this article, we’ll look at how to write code for no operation with JavaScript.

How to write code for no operation with JavaScript?

To write code for no operation with JavaScript, we can create an empty function.

For instance, we write

const noop = () => {};
setTimeout(noop, 10000);

to create the noop function.

And then we call setTimeout with noop to run it after 10000 milliseconds.

Conclusion

To write code for no operation with JavaScript, we can create an empty function.