|  | function replaceChildren(element, newChildren) {
  removeChildren(element);
  addChildren(element, newChildren);
}
function addChildren(element, children) {
  for (let child of children) {
    element.appendChild(child);
  }
}
function removeChildren(element) {
  while (element.lastChild) {
    element.removeChild(element.lastChild);
  }
}
function round(val, places = 0) {
  return Math.round(val * Math.pow(10, places)) / Math.pow(10, places);
}
function mapObject(obj, func) {
  return deepFreeze(Object.keys(obj).reduce((o, k) => ({ ...o, [k]: func(obj[k])}), {}));
}
function deepFreeze(object) {
  // Retrieve the property names defined on object
  var propNames = Object.getOwnPropertyNames(object);
  // Freeze properties before freezing self
  
  for (let name of propNames) {
    let value = object[name];
    object[name] = value && typeof value === "object" ? 
      deepFreeze(value) : value;
  }
  return Object.freeze(object);
}
function showBuilding(key) {
  let count = belongings[key].count;
  let name = count == 1 ? buildings[key].name : buildings[key].plural;
  return count + " " + name.toLowerCase()
}
function capitalize(string) {
  return string[0].toUpperCase() + string.slice(1)
}
 |