How to Create a Noop Function in JavaScript?

Learn about the different syntaxes you can use to create a noop function in JavaScript

A "noop" (no-op, or NOP) is a "no-operation" function, which does nothing. We can create a noop function in JavaScript in the following ways:

function noop() {}
const noop = function () {};

// or, ES6+ equivalent
const noop = () => {};

Hope you found this post useful. It was published . Please show your love and support by sharing this post.