<canvas height="50" width="100%">
<text id="message" multiline="true">
<method name="returnsum" args="a,b">
var sum = 3 + 4;
this.setAttribute('text', ('a + b = ' + sum));
return sum;
</method>
</text>
<script>
var x = 5;
var y = message.returnsum();
var z = x + y;
message.add(+z);
</script>
</canvas>