# value()?

## `Range.prototype.value`

The `value` accessor indicates the range current value of the [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type of a specified [`Range`](/range-1/range/overview.md) object.

### `get`

The [`get`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) accessor retrieves the [`#value`](/range-1/range/properties/value.md#value) property that indicates the range current value of the [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type of a specified [`Range`](/range-1/range/overview.md) object. It can be set by the [`setValue()`](/range-1/range/methods/setvalue.md) method.

{% code title="range.class.ts" %}

```typescript
public get value(): number | undefined {
  return this.#value;
}
```

{% endcode %}

### `set`

The [`set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set) accessor sets the range current value of the [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type between the [minimum](/range-1/range/properties/min.md) and [maximum](/range-1/range/properties/max.md) of a specified [`Range`](/range-1/range/overview.md) object.

{% code title="range.class.ts" %}

```typescript
public set value(value: number | undefined) {
  typeof value === 'number'
    ? this.has(value) && (this.#value = value)
    : undefined;
}
```

{% endcode %}

### Type

#### [<mark style="color:green;">`number`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#number)`|`[<mark style="color:green;">`undefined`</mark>](https://www.typescriptlang.org/docs/handbook/basic-types.html#null-and-undefined)

## Example usage

```typescript
// Example usage.
import { Range } from '@angular-package/range';

// Create new instance.
// Returns Range {min: -27, max: 27, value: 11} of Range<4, 27, 1>.
const range = new Range(-27, 27, 11);

// Returns 11 of type number | undefined.
range.value;

// Sets below minimum.
range.value = -28;

// Returns 11. Nothing was changed.
range.value;

// Sets above maximum.
range.value = 28;

// Returns 11. Nothing was changed.
range.value;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.angular-package.dev/range-1/range/accessors/value.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
