Create a new folder in Drive using Google App Script

Solution 1:

var parentFolder = DriveApp.getFolderById(parentFolderId);
var newFolder = parentFolder.createFolder("My New Folder Name");

Solution 2:

var parentFolder=DriveApp.getFolderById(DriveApp.getRootFolder().getId());
  var newFolder=parentFolder.createFolder("name folder")

Solution 3:

If you are going to need the folder ID to let's say move or create a file there you can do the following.

var parentFolder = DriveApp.getFolderById(parentFolderId);
var newFolderID = parentFolder.createFolder("New Folder Name").getId();

Then you can do this

DriveApp.getFolderById(newFolderID);