JavascriptEngine : access object prototype?

Hello there! Is there a way to access the prototype of a JS object ? So that we could write:

function Parent() {
    this.name = "parent";
};

function Child() {
    this.age = 7;
};

Child.prototype = new Parent();
Child.prototype.hair = "long";

var p = new Parent();
var c = new Child();

Demo.print ("p.name = " + p.name);
Demo.print ("c.age = " + c.age);
Demo.print ("c.hair = " + c.hair);
Demo.print ("c.name = " + c.name);

Right now, I obtain (with the latest JuceDemo)

p.name = parent
c.age = 7
c.hair = undefined
c.name = undefined

If anyone has a clue how to use or tweak the existing code to get that behavior, I’d appreciate that. Cheers !

1 Like