# How to check if layer with specific name exists?

**URL:** https://forums.creativeclouddeveloper.com/t/how-to-check-if-layer-with-specific-name-exists/3915
**Category:** UXP Plugin API
**Tags:** javascript
**Created:** [November 20, 2021, 2:41pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-check-if-layer-with-specific-name-exists/3915 "2021-11-20T14:41:14Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)
#### Post date: [November 20, 2021, 5:31pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-check-if-layer-with-specific-name-exists/3915/2 "2021-11-20T17:31:32Z")

</div>

A bit modified [answer of this topic](http://forums.creativeclouddeveloper.com/t/select-all-layers-with-specific-name/3237/2)

```auto
import {app} from "photoshop"

const layerExistsByName = (name) => {
  return Boolean(app.activeDocument?.layers?.some(layer => layer.name === name))
}

const exists = layerExistsByName("Some layer name")
console.log(exists) // true | false

```

---

_[View the full topic](https://forums.creativeclouddeveloper.com/t/how-to-check-if-layer-with-specific-name-exists/3915)._
