---
updatedAt: 2026-09-25T17:57:47.000Z
agentTools:
  projectIndex: https://docs.atono.io/llms.txt
---

# Implement a feature flag (JavaScript)

```javascript JavaScript
// add the following to your app initialization (run once at startup) 
const { Atono } = require('@atono-io/web-sdk');
const atono = Atono.fromEnvironmentKey('$ENV_KEY');
const featureFlags = await atono.getFeatureFlags();

// reference feature flags in your application logic as follows 
if (featureFlags.getBooleanValue('flag_name', false)) {
  // turn on the feature associated with your feature flag 
}
```

# Import the SDK

<!-- javascript@2 -->

Import the Atono SDK, which provides functionality to interact with Atono's feature flag system.

# Initialize the SDK for an environment

<!-- javascript@3 -->

Initialize the SDK client using a variable that references your environment key. You can copy the environment ID from the Environments page.

# Retrieve feature flags

<!-- javascript@4 -->

Use an asynchronous call to fetch the current feature flag configuration from Atono.

# Check if the flag is enabled

<!-- javascript@7 -->

If the feature flag is enabled ('true'), the code inside the 'if' statement will execute. If the feature flag is not enabled, the code inside the 'if' statement will be skipped.