How do I pass a value to an object in javascript? -
i have think called object(?) in javascript:
paymentwindow = new paymentwindow({ 'merchantnumber': "xxxxxx", 'amount': '10500', 'currency': "dkk" });
now want set amount value object. like:
paymentwindow.amount = '20000';
however, not work. sure simple, can't find solution.
now want able set amount outside object.
this easy or impossible, depending on how object looks like.
if constructor set this:
function paymentwindow(options) { this.amount = options.amount; }
then it's easy , works propose. attached this
becomes public property.
however, if constructor set this:
function paymentwindow(options) { var amount = options.amount; }
then it's impossible, because var amount
private constructed object.
Comments
Post a Comment