# range.isEqualTo()

{% tabs %}
{% tab title="JS" %}
```javascript
/**
 * App.isSameRange(r1, r2)
 */
App.isSameRange = function(range1, range2){
  return range1.getDataSourceUrl() === range2.getDataSourceUrl();
};
```
{% endtab %}

{% tab title="🗣 討論" %}


* [How do I compare two Range objects?](https://webapps.stackexchange.com/a/101949/274745)
{% endtab %}

{% tab title="📘 手冊" %}
* Range ⟩&#x20;
  * .[getDataSourceUrl](https://developers.google.com/apps-script/reference/spreadsheet/range#getdatasourceurl)()
  * .[getGridId](https://developers.google.com/apps-script/reference/spreadsheet/range#getgridid)() - grid ID of the range's **parent sheet**.
  * .[getA1Notation](https://developers.google.com/apps-script/reference/spreadsheet/range#geta1notation)() - e.g. **"A1:E2"**
{% endtab %}
{% endtabs %}
