jquery - How to resolve a Javascript Scope issue. Is closure the answer? -
this question has answer here:
i have function
function getcustomaddress() { alert(results[i].formatted_address) } alert(results[i].formatted_address) defined in function. means undefined in getcustomaddress, how resolve issue , alert values. have set fiddle well.
you pass function parameter
function getcustomaddress(result) { alert(result.formatted_address) } so when call function need supply 1 parameter: getcustomaddress(results[i]); example
Comments
Post a Comment