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

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -