Created
December 23, 2018 09:43
-
-
Save phillypb/0e3f20bd1f105188f6b7b54e9b1eecd0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pushToArray() { | |
// create an empty array | |
var students = [] | |
Logger.log('students array starts empty: ' + students); | |
// array with items to be pushed | |
var age = [7,8,9]; | |
// loop through each item and push into empy array | |
for (i=0;i<age.length;i++) { | |
students.push(age[i]); | |
} | |
// log output of new array | |
Logger.log('students array now contains: ' + students); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment