Home >Web Front-end >JS Tutorial >How jquery determines whether it is an array element

How jquery determines whether it is an array element

coldplay.xixi
coldplay.xixiOriginal
2020-12-11 15:46:022126browse

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)].

How jquery determines whether it is an array element

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn