# Creating JS functions that can take arguments in \_scripts (ReactiveHTML)

**URL:** <https://discourse.holoviz.org/t/creating-js-functions-that-can-take-arguments-in-scripts-reactivehtml/6823>\
**Category:** Panel\
**Created:** [February 3, 2024, 9:05pm UTC](https://discourse.holoviz.org/t/creating-js-functions-that-can-take-arguments-in-scripts-reactivehtml/6823 "2024-02-03T21:05:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dleybel](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/dleybel/32/6147_2.png) [@dleybel](https://discourse.holoviz.org/u/dleybel)\
**Post date:** [February 3, 2024, 9:05pm UTC](https://discourse.holoviz.org/t/creating-js-functions-that-can-take-arguments-in-scripts-reactivehtml/6823/1 "2024-02-03T21:05:01Z")

</div>

I’m trying to organize my JS in my ReactiveHTML component.  
Is having a script return a function the only way to do this, or am I missing something?

Currently using this pattern:

```javascript
"test": """
  return function test_fn(arg) {console.log(arg)}
""",
"after_layout": "self.test()('woohoo')"

```
