我有以下字符串
output_string = "[10, 10, [1,2,3,4,5], [10,20,30,40,50]]"
然后我JSON.parse
就
my_args = JSON.parse(output_string)
如何以类似 Python 的方式对其进行解包,以便其中的每个元素都my_args
成为 JavaScript 函数的参数?
some_javascript_function(*my_args)
// should be equivalent to:
some_javascript_function(my_args[0],my_args[1],my_args[2],my_args[3])
// or:
some_javascript_function(10, 10, [1,2,3,4,5], [10,20,30,40,50])
是否有一个核心的 JavaScript 习惯用法可以做到这一点?