How jquery determines whether it is an array element: You can use the [$.isArray()] function to determine whether the specified parameter is an array. The syntax is [$. isArray(object)].
The operating environment of this tutorial: windows7 system, jquery3.2.1 version. This method is suitable for all brands of computers.
How jquery determines whether it is an array element:
You can use the $.isArray()
function in jquery to determine whether it is an array element.
$.isArray()
The function is used to determine whether the specified parameter is an array.
Grammar
$.isArray( object )
Example:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML中文网</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script> </head> <body> [] 是一个数组吗?<b></b> <script> $(function () { $( "b" ).append( "" + $.isArray([]) ); }) </script> </body> </html>
Run result:
[] 是一个数组吗?true
Related free learning recommendations: javascript(Video )
The above is the detailed content of How jquery determines whether it is an array element. For more information, please follow other related articles on the PHP Chinese website!