Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function makeDictionary(input) {
- let dictionary = {};
- for (let line of input) {
- let currentWordAndDefinition = JSON.parse(line);
- let [currentWord, currentDefinition] = Object.entries(currentWordAndDefinition[0]);
- dictionary[currentWord] = currentDefinition;
- }
- let sortedDictionary = Object.entries(dictionary).sort((a, b) => a[0].localeCompare(b[0]));
- sortedDictionary.forEach(a => console.log(`Term: ${a[0]} => Definition: ${a[1]}`));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement