#!/usr/bin/env node; const Utils = require('./Utils'); const main = async () => { let dictionary = new Map(); console.log(["dictionary size: ", dictionary.size].join('')); console.log(["dictionary is ", (Utils.isEmpty(dictionary) ? "empty" : "not empty")].join('')); dictionary.set("apple", "red"); dictionary.set("banana", "yellow"); dictionary.set("cantaloupe", "orange"); dictionary.set("dragonfruit", "red"); dictionary.set("elderberry", "purple"); console.log(["dictionary size: ", dictionary.size].join('')); console.log(["dictionary is ", (Utils.isEmpty(dictionary) ? "empty" : "not empty")].join('')); console.log(["bananas are ", dictionary.get("banana")].join('')); let x = "dragonfruit"; if (dictionary.has(x)) { console.log([x, " are ", dictionary.get(x)].join('')); } else { console.log(["Can't find ", x].join('')); } x = "fig"; if (dictionary.has(x)) { console.log([x, " are ", dictionary.get(x)].join('')); } else { console.log(["Can't find ", x].join('')); } x = "elderberry"; dictionary.delete(x); if (dictionary.has(x)) { console.log([x, " are ", dictionary.get(x)].join('')); } else { console.log(["Can't find ", x].join('')); } console.log(Utils.mapToString(dictionary)); } main().catch( e => { console.error(e) } );