Categories
JavaScript Answers

How to write code for no operation with JavaScript?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *