1.8 KiB
1.8 KiB
id, title, challengeType
id | title | challengeType |
---|---|---|
587d825b367417b2b2512c8d | Create an ES6 JavaScript Map | 1 |
Description
.has(key)
returns true or false based on the presence of a key
.get(key)
returns the value associated with a key
.set(key, value)
sets a new key, value pair
.delete(key)
removes a key, value pair
.clear()
removes all key, value pairs
.entries()
returns an array of all the keys in insertion order
.values()
returns an array of all the values in insertion order
Instructions: Define a JavaScript Map object and assign to it a variable called myMap. Add the key, value pair freeCodeCamp
, Awesome!
to it.
Instructions
Tests
- text: The myMap object exists.
testString: 'assert(typeof myMap === ''object'', ''The myMap object exists.'');'
- text: 'myMap contains the key value pair <code>freeCodeCamp</code>, <code>Awesome!</code>.'
testString: 'assert(myMap.get(''freeCodeCamp'') === ''Awesome!'', ''myMap contains the key value pair <code>freeCodeCamp</code>, <code>Awesome!</code>.'');'
Challenge Seed
// change code below this line
Solution
// solution required