10日目
3693 ワード

アレイ
配列とは?1つの変数に複数の値を順番に格納するために使用します。
アレイの宣言方法
let arr1 = [];
let arr2 = new Array();
上のカッコを使用して空の配列を作成することもできます。
アレイの宣言時に初期値を設定することもできます。
arr1 = [];
空の配列が作成されました。配列長0
arr2 = ['white', 'red', 'black'];
初期値の設定時にアレイを作成します。
この配列の長さは3です。
配列の長さを求めます

JavaScriptタイプの入手方法
typeof()の使用

オブジェクトがtypeof()を使用して「object」を表す配列
だから配列はArrayisArray()の使用

配列のインデックス順序
ゼロから始まるインデックス

for...of
for...文には、繰り返し可能なオブジェクト(Array、Map、Set、String、TypedArray、argumentsオブジェクトなど)が含まれます。
const array1 = ['a', 'b', 'c'];
for (const element of array1) {
console.log(element);
}
// expected output: "a"
// expected output: "b"
// expected output: "c"

配列値の追加、削除(前、後、中)

.split()
電話番号、身分証明書番号などの数字から—条件によって区別する
1つの文で単語をスペースキーで区切る
ipアドレス。区切り表示で使用可能

Array.prototype.push()
配列末尾に値を追加:push()
const animals = ['pigs', 'goats', 'sheep'];
01)
const count = animals.push('cows');
console.log(animals);
// expected output: Array ["pigs", "goats", "sheep", "cows"]
02)
animals.push('chickens', 'cats', 'dogs');
console.log(animals);
// expected output: Array ["pigs", "goats", "sheep", "cows", "chickens", "cats", "dogs"]
Array.prototype.shift()
配列の先頭値の削除:shift()

Array.prototype.unshift()
配列の先頭に値を追加:unshift()
shift()メソッドは、配列から最初の要素を削除し、削除した要素を返します。この方法では、配列の長さが変更されます。

Array.prototype.concat()
concat()メソッドは、指定した配列または値をパラメータとして既存の配列にマージする新しい配列を返します。

Array.prototype.slice()
slice()メソッドは、配列の開始から終了(終了を含まない)までの浅いコピーを新しい配列オブジェクトに返します。元の案は変わらない。

Array.prototype.pop()
配列の末尾の値を削除する:pop()

Array.prototype.join()
join()メソッドは、配列内のすべての要素を文字列に接続します。

Reference
この問題について(10日目), 我々は、より多くの情報をここで見つけました https://velog.io/@jinsung8782/코드스테이츠-10일차テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol