jQuery.isFunction()    ** DEPRECATED **S2C Home « Utilities « jQuery.isFunction()

Plain object detection.

Description

The jQuery.isFunction() jQuery Type utility method, returns a boolean dependant upon the specified object having been created as a Function JavaScript object.

Shorthand version $.isFunction()

This method was deprecated in jQuery 3.3.

Syntax

Signature Description
jQuery.isFunction( object )Return a boolean dependant upon the specified object having been created as a Function JavaScript object.

Parameters

Parameter Description Type
objectThe object to test to see if it is a Function JavaScript object.PlainObject

Return

A Boolean object.

jQuery.isFunction( object ) ExampleTop

Return a boolean dependant upon the specified object having been created as a Function JavaScript object.

In the example below when we press the button we create some variables and test to see if they are Function JavaScript objects.


$(function(){
  $('#btn4').one('click', function(){
    var obj1 = 'aaa', obj2 = new Function('a', 'return a * a'), obj3 = {}, obj4 = new Object;
    $('#div4').append('Is obj1 a function? ' +  $.isFunction(obj1) + '<br>');
    $('#div4').append('Is obj2 a function? ' +  $.isFunction(obj2) + '<br>');
    $('#div4').append('Is obj3 a function? ' +  $.isFunction(obj3) + '<br>');
    $('#div4').append('Is obj4 a function? ' +  $.isFunction(obj4) + '<br>');
    $('#div4').append('Is function(){} a function? ' +  $.isFunction(function(){}) + '<br>');
  });
});

div4. Some initial text.

Press the button below to action the above code: