# path.getExtension

Function · category: Other

Source: https://github.com/playcanvas/engine/blob/970d89f6d3bc6667f4e1f88153abd6e7e82ed52c/src/core/path.js#L142

```ts
getExtension(pathname: string): string
```

Return the extension of the path. Pop the last value of a list after path is split by
question mark and comma.

**Parameters**

- `pathname` (`string`): The path to process.

**Returns** `string`: The extension.

**Example**

```ts
path.getExtension("/path/to/file.txt"); // returns ".txt"
path.getExtension("/path/to/file.jpg"); // returns ".jpg"
path.getExtension("/path/to/file.txt?function=getExtension"); // returns ".txt"
```
