# Write-Only Accessor
> [Define][@stdlib/utils/define-property] a **write-only** accessor.
## Usage
```javascript
var setWriteOnlyAccessor = require( '@stdlib/utils/define-write-only-accessor' );
```
#### setWriteOnlyAccessor( obj, prop, setter )
[Defines][@stdlib/utils/define-property] a **write-only** accessor.
```javascript
var obj = {};
var val = '';
function setter( v ) {
val = v;
}
setWriteOnlyAccessor( obj, 'foo', setter );
obj.foo = 'boop';
var bool = ( val === 'boop' );
// returns true
```
## Notes
- Write-only accessors are **enumerable** and **non-configurable**.
## Examples
```javascript
var setWriteOnlyAccessor = require( '@stdlib/utils/define-write-only-accessor' );
function Foo( secret ) {
if ( !(this instanceof Foo) ) {
return new Foo( secret );
}
setWriteOnlyAccessor( this, 'secret', setter );
return this;
function setter( v ) {
secret = v;
}
}
var foo = new Foo( 'beep' );
foo.secret = 'boop';
```
[@stdlib/utils/define-property]: https://www.npmjs.com/package/@stdlib/utils/tree/main/define-property