Lab - Hosts Module
by Ryan Morris
JavaScript
/*
* Hosts Exercise:
*
* Using an IIFE, change the `Hosts' variable below so that it becomes
* an object. The object should have four (4) properties that are all
* functions:
*
* add(name, address) - A function that takes two arguments, a host
* name and an IP address. The function should
* record that the given host has the specified
* IP address. Take note a host may have multiple ips.
*
* lookupByName(name) - A function that returns all IP addresses
* associated with the given host name. If the
* given name has not been recorded by a call
* to `add' then this function should return an
* empty array.
*
* lookupByIP(address) - A function that returns all host names that
* were recorded with the specified IP address.
* If the specified IP address does not have
* any host names associated with it then this
* function should return an empty array.
*
* clear() - A function that removes all host names and
* IP addresses from the Hosts object.
*
* Notes:
*
* - Do not introduce any new global variables. The `Hosts` variable
* is the only allowed global variable.
/*
* Hosts Exercise:
*
* Using an IIFE, change the `Hosts' variable below so that it becomes
* an object. The object should have four (4) properties that are all
* functions:
*
* add(name, address) - A function that takes two arguments, a host
* name and an IP address. The function should
* record that the given host has the specified
* IP address. Take note a host may have multiple ips.
*
* lookupByName(name) - A function that returns all IP addresses
* associated with the...