As of now we only have Basic datatypes as inputs to JS components which doesn't allow structures and list to be manipulated using JS. To achieve this ForEach component is used.
Solution:
Allow lists and structures as input and output parameter data types which are converted to JS arrays.