Home > Web Front-end > JS Tutorial > body text

How to declare array length in jquery

coldplay.xixi
Release: 2023-01-04 09:38:03
Original
2528 people have browsed it

How to declare the length of an array in jquery: directly use the [new Array(n)] statement to define an array of length n, declare an array with 10 elements, the code is [var a = new Array (10);].

How to declare array length in jquery

The operating environment of this tutorial: windows7 system, jquery3.2.1 version, DELL G3 computer.

Recommended: jquery video tutorial

How to declare the array length in jquery:

Use new Array directly (n)The statement can define an array of length n

Declare an array with 10 elements

var a = new Array(10);
Copy after login

At this time, the memory space has been opened for a, containing 10 elements , call it by adding [subscript] to the array name, such as a[2], but the element has not been initialized at this time, and the call will return undefined.

Related free learning recommendations: javascript(Video)

The above is the detailed content of How to declare array length in jquery. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template