Map
A map store its elements as pairs. So when we are adding a new element to a map, we need to create a pair which we then store inside the map using the method insert
. This is one way to do it, using the grades
map from the previous lesson example:
grades.insert({"Tem", 80});
The {"Tem", 80}
brace initialization creates the pair which is then inserted to grades
.
Your task is to create and insert more elements to the power_level
map. You need to put in:
Name | Power level |
Nappa | 4000 |
Goku | 9000 |
Vegeta | 18000 |