# JavaScript DynamicObject

**URL:** <https://forum.juce.com/t/javascript-dynamicobject/39070>\
**Category:** General JUCE discussion\
**Created:** [April 28, 2020, 3:00pm UTC](https://forum.juce.com/t/javascript-dynamicobject/39070 "2020-04-28T15:00:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darrenwin](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@darrenwin](https://forum.juce.com/u/darrenwin)\
**Post date:** [April 28, 2020, 3:00pm UTC](https://forum.juce.com/t/javascript-dynamicobject/39070/1 "2020-04-28T15:00:04Z")

</div>

I have seen posts a long while back, but nothing recently. If I have a DynamicObject registered with the JavascriptEngine and use the following JS code:  
var myVar = new MyDynamicObject();  
myVar.myFunction();

in c++ myFunction the following code is always null:  
auto\* thisObject = dynamic\_cast\< MyDynamicObject\*\> (args.thisObject.getObject())

However if I call it using MyDynamicObject.myFunction();  
it works great.  
What is a way to be able to set a bunch of variables on an object (DynamicObject) and then call a function to use these variables?
