Is it possible for Run Code to return an array or object of variable number of elements?

I’m using a Run Code block to split a string into words, and the number of words may vary.
There is no output type of Array or Object.
The only way around that I found so far is to define a fixed number of output elements, and default them to “”.
Is there a better way?
Thanks

let wordsArray = input.metaobject.text.split(' ');  
  return {
    word_1 : wordsArray[0] ?? "",
    word_2 : wordsArray[1] ?? "",
    word_3 : wordsArray[2] ?? "",
    word_4 : wordsArray[3] ?? "",    
  }

I think you can do it by defining the Output as

"The output of Run Code"
type Output {
  words: [String]
}

and then your code:

return input.metaobject.text.split(' ');
1 Like
 words: [String]

worked.

Thanks!