Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Using array destructuring, fix the following code to print the keys and values of the `members` Map to the console.
- */
- const members = new Map();
- members.set('Evelyn', 75.68);
- members.set('Liam', 20.16);
- members.set('Sophia', 0);
- members.set('Marcus', 10.25);
- let a, b;
- for (const member of members) {
- [a , b] = member;
- console.log(a , b);
- }
- //output
- // Evelyn 75.68
- // Liam 20.16
- // Sophia 0
- // Marcus 10.25
- //Last option members.forEach((value, key) => console.log(key, value));
Add Comment
Please, Sign In to add comment