IBM Support

Differences in javascript string/array add operator - ITIM 5.1 & ISIM 6

Question & Answer


Question

The javascript add operator between String and Array behaves differently between ITIM v5.1 and ISIM v6.

Cause

The difference here is caused by the change of the JavaScript engine used by ITIM v.5.1 (FESI JS) and the new one used by ISIM v.6 (IBMJS).

For example:
var array = array(5,3,2,1);
process.auditEvent("this is just text" + array);

In 5.1 the result is:
"this is just text 5,
this is just text3,
this is just text2,
this is just text1"

While in 6.0 the result is:
"this is just text 5, 3, 2, 1"

Answer

The behaviour in the IBMJS JavaScript engine (used in ISIM v6) is the standard one from documentation (http://ecma262-5.com/ELS5_Section_11.htm#Section_11.6.1).

The + operator is not defined for arrays but only for numbers and strings; so if the toString() method is called on the array object; it will return the list of array elements, comma separated, as a string that will be concatenated to other strings as usual.

[{"Product":{"code":"SSRMWJ","label":"IBM Security Identity Manager"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Server","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"5.1;6.0","Edition":"","Line of Business":{"code":"LOB24","label":"Security Software"}}]

Document Information

Modified date:
16 June 2018

UID

swg21987220