title: How a iterator can be acccessed from a Folder? ("TypeError: Cannot find function hasNext in object File,File,File..." )
body: <p>Following <a href="https://developers.google.com/apps-script/reference/drive/file-iterator" rel="nofollow noreferrer">this documentation</a> code (where is said that "File iterators can be acccessed from DriveApp or a Folder."):</p>
  
  <p><img src="https://i.stack.imgur.com/yya3V.png" alt="enter image description here"></p>
  
  <p>I wrote this code to iterate through the files of a folder:</p>
  
  <pre><code>var folder = DocsList.getFolderById('0B9HEC6UUJxrsYWNPYko0M3dBRU0');
    var files = folder.getFiles();
    arrayList = [];
    while ( files.hasNext() ) {
     var file = files.next();
      var newArray = [];
      var fileName = file.getName();
      var fileId = file.getId();
      newArray.push(fileName);
      newArray.push("some info");
      newArray.push(fileId);
      arrayList.push(newArray);
    }
  </code></pre>
  
  <p>But I got this error: <code>TypeError: Cannot find function hasNext in object File,File,File,File,File,File,File,File,File,File,...</code>. How to fix that? How a iterator can be acccessed from a Folder?</p>