Why is this global variable not recognised in javascript function? -
despite excessive googling don't why function dosomething nil in situation below. thought why doesn't work?
many thanks, gordon
var arrattend=new object(); arrattend["blob"]='hello'; function dosomething() { alert (arrattend["blob"]); }
it's typo, should utilize new object
(capital o). or utilize object literal:
var arrattend = {blob: 'hello'}; function dosomething() { alert (arrattend.blob); }
javascript variables global
No comments:
Post a Comment