code: function findByName(array, name) {
          if (array && array.length > 0) {
              for (var i = 0, len = array.length; i < len; i++) {
                  var elem = array[i];
                  if (elem.name == name) {
                      return elem;
                  }
              }
          }
          return null;
      }
docs: Find element by name in a given array.
  
  @param {Array.<Element>} array
  @param {string} name
  @return {Element}