What is the use of jQuery.noop() function?

I was going through one Backbone.js plugin in which I found the below piece of code.

callbacks : {
    search : $.noop,
    valueMatches : $.noop

What is the $.noop() function doing here?



$.noop is an empty function so in your case it's returning an empty function

You can use this empty function when you wish to pass around a function that will do nothing.

This is useful for plugin authors who offer optional callbacks; in the case that no callback is given, something like jQuery.noop could execute.

Documentation found here : http://api.jquery.com/jquery.noop/


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.