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

Popular posts from this blog

android - Inheriting from Theme.AppCompat* -

broadcastreceiver - android BOOT_COMPLETED not received if not activity intent-filter -

basic authentication with http post params android -