text: import { NotImplementedError } from '../extensions/index.js';
  
  /**
   * Given an array of domains, return the object with the appearances of the DNS.
   *
   * @param {Array} domains
   * @return {Object}
   *
   * @example
   * domains = [
   *  'code.yandex.ru',
   *  'music.yandex.ru',
   *  'yandex.ru'
   * ]
   *
   * The result should be the following:
   * {
   *   '.ru': 3,
   *   '.ru.yandex': 3,
   *   '.ru.yandex.code': 1,
   *   '.ru.yandex.music': 1,
   * }
   *
   */
  export default function getDNSStats(domains) {
    let result = {};
    domains.map(function(a) {
      let link = a.split('.').reverse();
      let key = ''
      link.map(function(b) {
        key += `.${b}`
        if (result[key])  result[key]++
        else result[key] = 1;
      })
    })
    return result;
    // remove line with error and write your code here
  }
  