---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# String.prototype.codePointAt()

The **`codePointAt()`** method returns a non-negative integer
that is the Unicode code point value at the given position.
Note that this function does not give the nth code point in a string,
but the code point starting at the specified string index.

## Syntax

```js
codePointAt(pos)
```

### Parameters

- `pos`
  - : Position of an element in `str` to return the code point value
    from.

### Return value

A decimal number representing the code point value of the character at the given `pos`.

- If there is no element at `pos`, returns [`undefined`](../../../globals/undefined.mdx).
- If the element at `pos` is a UTF-16 high surrogate, returns the code point of the surrogate _pair_.
- If the element at `pos` is a UTF-16 low surrogate, returns _only_ the low surrogate code point.
