I am having trouble accessing fields(variables) in a function definition. My question is with this code:
<script>
function test(){ var book= [];}
var arrs = test();
alert(arr.book);
</script>
It gives me 'undefined', why? I would expect it to be an empty value. Is there any way I can access this book
array variable in arrs
?
Aucun commentaire:
Enregistrer un commentaire