#alternative to spread array (...)

8 messages · Page 1 of 1 (latest)

molten hawk
#

hello im wondering how can I pass a single array variable to be assigned to multiple arguments of a function

fading stormBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

haughty quiver
#

What specifically do you want to do? We need more context to be able to understand how to help. However, this sounds like more of a general js question and less of a kubejs question

quaint laurel
#
const aList = [1, 2, 3]
const [b, c, d, e] = aList
console.log(b, c, d, e)
#
example.js#29: 1.0
example.js#29: 2.0
example.js#29: 3.0
example.js#29: undefined
#

of course it's not as convenient as spread array as you'd need to know how many parameters the function take though