We are facing issue trying to concatenating two string in in HTL java-script use api .
In my info.js (rendering server side and used in template using data-sly-use ):
var a = ‘String 1’,
b -= ‘String 2’
Option 1: var c = a+’_’+ b; //Tried concatenating with ‘+’
Expected String 1_ String 2
Getting: Java error
Option 2: var c = a.concat(_).concat(b) // Tried concat operation
Expected String1_String2
Getting: Sting1,_,String2
Option 3: var c=[];
- c.push=a;
- c.push=b;
- c.join(‘_’) // Tried join
Expected: String1_String2
Getting: [Ljava.lang.String;@83e0d6bf_[Ljava.lang.String;@e4896fbb_JPEG