# has()

## `Range.prototype.has()`

The `has()` method checks whether the [`value`](#value-number) is in the range of a specified [`Range`](https://range.angular-package.dev/range) object.

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

```typescript
public has(value: number): boolean {
  return (
    (this.minLessThan(value) && this.maxGreaterThan(value)) ||
    value === this.min ||
    value === this.max
  );
}
```

{% endcode %}

### Parameters

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

The value of [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) type to test.

### Return type

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

### Returns

The **return value** is a [`boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) indicating whether the given [`value`](#value-number) is in the range of a specified [`Range`](https://range.angular-package.dev/range) object.

## Example usage

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

// Create new instance.
const range = new Range(4, 27);

// Returns false.
range.has(3);

// Returns true.
range.has(4);

// Returns false.
range.has(28);

// Returns true.
range.has(27);
```


---

# 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://range.angular-package.dev/range/methods/has.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.
