code: function(location) {
    var error;
  
    if (!Array.isArray(location)) {
      error = "location must be an array";
    }
    else if (location.length !== 2) {
      error = "expected array of length 2, got length " + location.length;
    }
    else {
      var latitude = location[0];
      var longitude = location[1];
  
      if (typeof latitude !== "number" || isNaN(latitude)) {
        error = "latitude must be a number";
      }
      else if (latitude < -90 || latitude > 90) {
        error = "latitude must be within the range [-90, 90]";
      }
      else if (typeof longitude !== "number" || isNaN(longitude)) {
        error = "longitude must be a number";
      }
      else if (longitude < -180 || longitude > 180) {
        error = "longitude must be within the range [-180, 180]";
      }
    }
  
    if (typeof error !== "undefined") {
      throw new Error("Invalid WildGeo location '" + location + "': " + error);
    }
  }
docs: Validates the inputted location and throws an error if it is invalid.
  校验输入的坐标，如果不合法抛出错误
  @param {Array.<number>} location 经纬坐标数组对