Und hier der Rest:
function Grafik( jsonData, width, height ) {
this.maxLabel = 150;
this.init = function() {
console.log( this.maxLabel + ' | ' + 'width='+ width + ' | height=' + height );
this.hash = JSON.parse(jsonData);
console.log( this.hash['foo'] );
}
this.init();
}
grafik = new Grafik('{"foo":"bar"}', 100, 200);
console.log(grafik.hash.foo);
Ausgaben:
node test.js
150 | width=100 | height=200
bar
bar