In case anyone got here with the same question, I found the correct way to do this.
I created a sprite object, named MenuBackground, and added a custom behavior I named TestJS. It has a single property, named MyStrProperty, which is a string with default value “Test”.
To access this property from javascript code, I first needed to create a behavior function, getMyStrProperty, which sole purpose is to return the property value.
Then, from JS, we need to first get the object containing the behavior, passing “Object” as its name. Why? Because this is the name of the parameter containing information about the current object.
Next step, we get from the function also the name of the behavior which came from the parameter “Behavior”. We will use its name to get the exact behavior from current object. As soon as we get the behavior, we can call the proper created function to get the param value.