1
votes

I have in a SSJS javascript a function that takes in a parameter. In the function I need to check what type of element the parameter is.

I can check for example if that type is an array:

if(false == values instanceof Array)

I notice that sometimes the incoming parameter is an ArrayList of strings. Is it possible to check against this type also in SSJS?

For now I just convert the object type before I send it to the function.

1
Did you try instanceof ArrayList or instanceof List ? It should work.Knut Herrmann
Script interpreter error, line=212, col=43: [ReferenceError] 'ArrayList' not foundPatrick Kwinten
Script interpreter error, line=212, col=43: [ReferenceError] 'List' not foundPatrick Kwinten

1 Answers

3
votes

You can check with

values instanceof java.util.ArrayList

or with

values instanceof java.util.List

if you want to cover all sorts of Java Lists.