Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function adressBook(array) {
- let obj = {};
- for(const info of array) {
- [name, address] = info.split(':');
- obj[name] = address;
- }
- let sortedKeys = Object.keys(obj).sort();
- for (const key of sortedKeys) {
- console.log(`${key} -> ${obj[key]}`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement