Complexity Management and Intuitive Code Organization
SuiteScript 2.x is built around modularity. Modern SuiteApps need complex scripts with lots of code and files, and modularity helps manage that complexity. It also adds encapsulation, makes code organization more intuitive, and prevents global variable or method naming conflicts.
SuiteScript 2.x comes with a full set of new APIs, all organized into modules based on what they do. For example, you use the N/file module to work with files in NetSuite. Your script only loads the modules it needs. In SuiteScript 1.0, all APIs are in one big global namespace, so every script uses the whole namespace no matter which APIs it needs.
SuiteScript 2.x also lets you create your own custom modules. You can use these to organize your code (instead of SuiteScript 1.0 libraries). You can even add custom modules to SuiteApps and share them with third parties.
For additional information, see the following help topics:
SuiteScript 2.x uses the Asynchronous Module Definition (AMD) specification to define and load JavaScript modules and their dependencies. For more about AMD, see http://requirejs.org/docs/whyamd.html and https://github.com/amdjs/amdjs-api/blob/master/AMD.md.