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

I was looking through one plugin Backbone.jsin which I found the code below.

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

What does the function do here $.noop()?

+4
source share
1 answer

$.noop is an empty function, so in your case it returns an empty function

You can use this empty function when you want which will do nothing.

This is useful for plugin authors who offer additional callbacks; in the case where the callback is not specified, something like jQuery.noop is executed.

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

+8
source

Source: https://habr.com/ru/post/1525380/


All Articles