google apps script - Using the contents of an array outside a function -


is there possibility use contents of array in function? example, have following code:

var locations = [];  function values() {  var values = ['test1','test1']  (i in values) {    locations.push(values[i]);  } }  logger.log(locations) 

now logs nothing, if place logger in function, returns contents of array.

call function values(); this

var locations = []; values();  function values() {  var values = ['test1','test1'];  (i in values) {    locations.push(values[i]);  } }  logger.log(locations); 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -