# ee.Array.first

On an element-wise basis, selects the value of the first value.

<br />

| Usage | Returns |
|---|---|
| `Array.first(right)` | Array |

| Argument | Type | Details |
|---|---|---|
| this: `left` | Array | The left-hand value. |
| `right` | Array | The right-hand value. |

## Examples

### Code Editor (JavaScript)

```javascript
var empty = ee.Array([], ee.PixelType.int8());
print(empty.first(empty));  // []

print(ee.Array([0]).first(0));  // [0]
print(ee.Array([0, 1, 2]).first(1));  // [0,1,2]
print(ee.Array([0, 1, 2]).first(ee.Array([3, 4, 5])));  // [0,1,2]
print(ee.Array([3, 4, 5]).first(ee.Array([0, 1, 2])));  // [3,4,5]
```
Python setup

See the [Python Environment](https://developers.google.com/earth-engine/guides/python_install) page for information on the Python API and using
`geemap` for interactive development.

```python
import ee
import geemap.core as geemap
```

### Colab (Python)

```python
empty = ee.Array([], ee.PixelType.int8())
display(empty.first(empty))  # []

display(ee.Array([0]).first(0))  # [0]
display(ee.Array([0, 1, 2]).first(1))  # [0,1,2]
display(ee.Array([0, 1, 2]).first(ee.Array([3, 4, 5])))  # [0, 1, 2]
display(ee.Array([3, 4, 5]).first(ee.Array([0, 1, 2])))  # [3, 4, 5]
```