我有以下字符串
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语言习惯用法可以做到这一点?