| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..
* Some parts of this feature may have varying levels of support.
, . JavaScript-, . , , . , , , , undefined. , ; , .
, . , , . JavaScript- (.) .
JavaScript : , 0, length 1.
const arr = [" ", " ", " "];
console.log(arr[0]); // ' '
console.log(arr[1]); // ' '
console.log(arr[arr.length - 1]); // ' '
, , , , toString, , JavaScript:
console.log(arr.0); //
. JavaScript , , ; . , , '3d', . :
const years = [1950, 1960, 1970, 1980, 1990, 2000, 2010];
console.log(years.0); //
console.log(years[0]); //
renderer.3d.setTexture(model, 'character.png'); //
renderer['3d'].setTexture(model, 'character.png'); //
, 3d : '3d'. ( years['2'] years[2]), . 2 years[2] JavaScript toString. '2' '02' years true:
console.log(years["2"] != years["02"]);
, , (!) :
const promise = {
var: "text",
array: [1, 2, 3, 4],
};
console.log(promise["array"]);
length length . (, join, slice, indexOf ..) length . (, push, splice ..) length .
const fruits = [];
fruits.push("", "", "");
console.log(fruits.length); // 3
, , length:
fruits[5] = "";
console.log(fruits[5]); // ''
console.log(Object.keys(fruits)); // ['0', '1', '2', '5']
console.log(fruits.length); // 6
length
fruits.length = 10;
console.log(Object.keys(fruits)); // ['0', '1', '2', '5']
console.log(fruits.length); // 10
, length .
fruits.length = 2;
console.log(Object.keys(fruits)); // ['0', '1']
console.log(fruits.length); // 2
, Array.length.
JavaScript-. , . RegExp.exec, String.match String.replace. , , :
// d,
// b, d
// b d
//
const myRe = /d(b+)(d)/i;
const myArray = myRe.exec("cdbBdbsbz");
, , :
| / | ||
|---|---|---|
input |
, , . | cdbBdbsbz |
index |
, ( ) , . | 1 |
[0] |
, . | dbBd |
[1], ...[n] |
, , , . . | [1]: bB [2]: d |
Array() Array.
Array[@@species] Array.
Array.from() Array .
Array.fromAsync() Array , .
Array.isArray() true false .
Array.of() Array , .
Array.prototype Array.
Array.prototype.constructor-, . Array Array.
Array.prototype[@@unscopables] , ECMAScript ES2015 with.
Array:
length.
Array.prototype.at(). , .
Array.prototype.concat(), .
Array.prototype.copyWithin().
Array.prototype.entries()array iterator, / .
Array.prototype.every() true true.
Array.prototype.fill().
Array.prototype.filter() , , true.
Array.prototype.find() , true, undefined .
Array.prototype.findIndex() , true, -1 .
Array.prototype.findLast() , true, undefined .
Array.prototype.findLastIndex() , true, -1 .
Array.prototype.flat(), .
Array.prototype.flatMap(), , .
Array.prototype.forEach().
Array.prototype.includes() true, false .
Array.prototype.indexOf()() , .
Array.prototype.join().
Array.prototype.keys()Array.prototype.lastIndexOf() () , -1 .
Array.prototype.map(), .
Array.prototype.pop().
Array.prototype.push() length .
Array.prototype.reduce()- ( ) .
Array.prototype.reduceRight()- ( ) .
Array.prototype.reverse()( ) ( , ).
Array.prototype.shift().
Array.prototype.slice().
Array.prototype.some() true true.
Array.prototype.sort()( ) .
Array.prototype.splice()/ .
Array.prototype.toLocaleString()Array.prototype.toReversed().
Array.prototype.toSorted().
Array.prototype.toSpliced()/ .
Array.prototype.toString()Array.prototype.unshift() length .
Array.prototype.values()Array.prototype.with().
Array.prototype[@@iterator]() msgArray 0, msgArray[0] msgArray[99], 100.
const msgArray = [];
msgArray[0] = "";
msgArray[99] = "";
if (msgArray.length === 100) {
console.log(" 100.");
}
const fruits = ["", ""];
console.log(fruits.length);
// 2
const first = fruits[0];
//
const last = fruits[fruits.length - 1];
//
fruits.forEach(function (item, index, array) {
console.log(item, index);
});
// 0
// 1
const newLength = fruits.push("");
// ["", "", ""]
const last = fruits.pop(); // ( )
// ["", ""];
const first = fruits.shift(); // ( )
// [""];
const newLength = fruits.unshift(""); //
// ["", ""];
fruits.push("");
// ["", "", ""]
const pos = fruits.indexOf("");
// 1
const removedItem = fruits.splice(pos, 1); //
// ["", ""]
splice() fruits "" "" "" , .
const fruits = ["", "", "", ""];
const start = 1;
const deleteCount = 2;
const removedItems = fruits.splice(start, deleteCount);
console.log(fruits);
// ["", ""]
console.log(removedItems);
// ["", ""]
const shallowCopy = fruits.slice(); //
// ["", ""]
. 'p' (6,4) (4,4). (6,4) .
const board = [
["R", "N", "B", "Q", "K", "B", "N", "R"],
["P", "P", "P", "P", "P", "P", "P", "P"],
[" ", " ", " ", " ", " ", " ", " ", " "],
[" ", " ", " ", " ", " ", " ", " ", " "],
[" ", " ", " ", " ", " ", " ", " ", " "],
[" ", " ", " ", " ", " ", " ", " ", " "],
["p", "p", "p", "p", "p", "p", "p", "p"],
["r", "n", "b", "q", "k", "b", "n", "r"],
];
console.log(board.join("\n") + "\n\n");
//
board[4][4] = board[6][4];
board[6][4] = " ";
console.log(board.join("\n"));
:
R,N,B,Q,K,B,N,R P,P,P,P,P,P,P,P , , , , , , , , , , , , , , , , , , , , , , , , , , , , p,p,p,p,p,p,p,p r,n,b,q,k,b,n,r R,N,B,Q,K,B,N,R P,P,P,P,P,P,P,P , , , , , , , , , , , , , , , , , ,p, , , , , , , , , , p,p,p,p, ,p,p,p r,n,b,q,k,b,n,r
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-array-objects |
This page was last modified on 29 . 2026 . by MDN contributors.
ArrayArray.prototype.at()Array.prototype.concat()Array.prototype.copyWithin()Array.prototype.entries()Array.prototype.every()Array.prototype.fill()Array.prototype.filter()Array.prototype.find()Array.prototype.findIndex()findLast()findLastIndex()Array.prototype.flat()Array.prototype.flatMap()Array.prototype.forEach()Array.prototype.includes()Array.prototype.indexOf()Array.prototype.join()Array.prototype.keys()Array.prototype.lastIndexOf()Array.prototype.map()Array.prototype.pop()Array.prototype.push()Array.prototype.reduce()Array.prototype.reduceRight()Array.prototype.reverse()Array.prototype.shift()Array.prototype.slice()Array.prototype.some()Array.prototype.sort()Array.prototype.splice()Array.prototype.toLocaleString()Array.prototype.toReversed()Array.prototype.toSorted()toSpliced()Array.prototype.toString()Array.prototype.unshift()Array.prototype.values()Array.prototype.with()Array.prototype[@@iterator]()Object/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |