`growthbook.isOn()` never returns true on the Java...
# ask-questions
c
growthbook.isOn()
never returns true on the Javascript sdk. What am I doing wrong?
Hi, I’m just getting started with GrowthBook on a side project using plain javascript. Copied the installation and quick usage starter code from the docs into my html page. I see the flag enabled on https://cdn.growthbook.io/api/features/prod_cbAOvmDygOHhAGOsaKdMhs7lI3wfI9bNAIqIeyNhos
Copy code
{
  "status": 200,
  "features": {
    "alas": {
      "defaultValue": true
    },
    "bar": {
      "defaultValue": "foo"
    },
    "lorem": {
      "defaultValue": true
    }
  },
  "dateUpdated": "2022-11-06T00:34:37.739Z"
}
In browser console, I’m not seeing
lorem
enabled:
Copy code
if (growthbook.isOn("lorem")) {
            console.log("Lorem is on")
        } else {
            console.log("Lorem is off")
        }
Lorem is off
gb.html
f
Hi, in your code, you are calling
setFeatures
asynchronously, so it's not available immediately. If you wait until after that to call
growthbook.isOn
it should work.
c
hi @future-teacher-7046 thanks for replying! I tried to wrap the `growthbook.isOn` call in async/await however it didn’t seem to work either. is there a reference implementation I can follow?