During development, use an incognito session in your browser and add nlapiLogExecution functions to your code to view data flow, which helps in debugging.
Remove all logging calls post-debugging since they can slow down performance if triggered, but you may keep them to catch logs in case of problems. If a script fails, these calls can send notifications to you or others, configurable under the Unhandled Errors tab in the script record.
Notifications are sent only for unhandled exceptions, like calling a non-existent function in the script. Refer to SuiteScript 1. 0 Documentation for more details on exceptions and notifications.
When debugging, be aware of these limitations: SuiteScript 2. 0 user event scripts and client scripts cannot run together for Scriptable Cart. Typically, SuiteScript 1. 0 is better for user events and SuiteScript 2. 0 for client events, although the reverse is also valid. Changes are not visible in active sessions or browsers.