Files
freeCodeCamp/curriculum/challenges/japanese/10-coding-interview-prep/data-structures/create-an-es6-javascript-map.md
2022-01-20 20:30:18 +01:00

1.8 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
587d825b367417b2b2512c8d ES6 JavaScript マップを作成する 1 301635 create-an-es6-javascript-map

--description--

JavaScript の新バージョンでは、前回のチャレンジで手書きした機能の多くを提供する、組み込みの Map ブジェクトが提供されています。 This Map object, although similar to regular JavaScript objects, provides some useful functionality that normal objects lack. For example, an ES6 Map tracks the insertion order of items that are added to it. より網羅的なメソッドの概要を次に示します。.has(key) はキーの有無に基づいて true または false を返します。.get(key) はキーに関連付けられた値を返します。.set(key, value) は新しいキーと値のペアを設定します。.delete(key) はキーと値のペアを削除します。.clear() はすべてのキーと値のペアを削除します。.entries() は挿入順にすべてのキーの配列を返します。.values() は挿入順にすべての値の配列を返します。

--instructions--

JavaScript Map オブジェクトを定義し、変数 myMap をそのオブジェクトに割り当ててください。 キーと値のペア freeCodeCampAwesome! (すばらしい!) を追加してください。

--hints--

myMap オブジェクトが存在する必要があります。

assert(typeof myMap === 'object');

myMap にはキーと値のペア freeCodeCampAwesome! が含まれている必要があります。

assert(myMap.get('freeCodeCamp') === 'Awesome!');

--seed--

--seed-contents--


--solutions--

const myMap = new Map();

myMap.set("freeCodeCamp", "Awesome!");