# How to change a variable value in Javascript?

**URL:** <https://community.weweb.io/t/how-to-change-a-variable-value-in-javascript/7156>\
**Category:** How do I?\
**Created:** [February 21, 2024, 9:55am UTC](https://community.weweb.io/t/how-to-change-a-variable-value-in-javascript/7156 "2024-02-21T09:55:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![unlustucru](https://avatars.discourse-cdn.com/v4/letter/u/e36b37/32.png) [@unlustucru](https://community.weweb.io/u/unlustucru)\
**Post date:** [February 21, 2024, 9:55am UTC](https://community.weweb.io/t/how-to-change-a-variable-value-in-javascript/7156/1 "2024-02-21T09:55:50Z")

</div>

I’m trying to use pure Javascript to change a boolean variable’s value:

```auto
variables[/* myVar */'fd25e204-0283-4ea7-a4e1-8b3ad10a6cca'] = false;

```

This doesn’t work. What’s the correct way to change a variable value in Javascript?

---

<div class="post-metadata">

**Author:** ![luka](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/luka/32/1571_2.png) [@luka](https://community.weweb.io/u/luka)\
**Post date:** [February 21, 2024, 10:39am UTC](https://community.weweb.io/t/how-to-change-a-variable-value-in-javascript/7156/2 "2024-02-21T10:39:39Z")

</div>

Can you post the context of where you’re trying to use this?

---

<div class="post-metadata">

**Author:** ![unlustucru](https://avatars.discourse-cdn.com/v4/letter/u/e36b37/32.png) [@unlustucru](https://community.weweb.io/u/unlustucru)\
**Post date:** [February 23, 2024, 5:42am UTC](https://community.weweb.io/t/how-to-change-a-variable-value-in-javascript/7156/3 "2024-02-23T05:42:09Z")

</div>

@luka I have an audio element on my page, and a JS script that returns “true” if the audio playback is \>= 95%. Instead of just returning “true”, I’d like to change the variable value to “true”—that is, directly in the JS script.

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [February 23, 2024, 8:18am UTC](https://community.weweb.io/t/how-to-change-a-variable-value-in-javascript/7156/4 "2024-02-23T08:18:07Z")

</div>

the easiest way to interact with weweb stuff from an external script is to trigger a global workflow with `wwLib.executeWorkflow(id,parameters)` so that you can pass values and use them in the nocode workflow

---

<div class="post-metadata">

**Author:** ![benFortunato](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@benFortunato](https://community.weweb.io/u/benFortunato)\
**Post date:** [February 25, 2024, 2:19pm UTC](https://community.weweb.io/t/how-to-change-a-variable-value-in-javascript/7156/5 "2024-02-25T14:19:59Z")

</div>

FYI a quick rundown of how to do that by @dorilama is here: [Editing values from a custom JavaScript Embed](https://community.weweb.io/t/editing-values-from-a-custom-javascript-embed/3055)
