parseInt Difference

The parseInt function operates differently in SuiteScript 2.1 than in SuiteScript 2.0, in some situations. To avoid encountering incorrect results, follow best practices when using the parstInt function, which can be found at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt.

Scenario

SuiteScript 2.0 Behavior

SuiteScript 2.1 Behavior

Parse a string value representing a number.

                    require([],function() { 
    var x = parseInt('08');
    log.debug('x', x); 
}); 

                  

There is no value assigned to x.

The return value for x is 8.

Related Topics

General Notices