0

In Python if you have a function like this:

def my_function(param1, param2, param3):
  print (param1, param2, param3)

And you have dictionary like this:

my_dict = {"param1": 1,
           "param2": 2,
           "param3": 3}

Then you can destructure a dictionary and pass the values in the dictionary to the function like this:

my_function(**my_dict)

which basically calls my_function(1, 2, 3)

Is there any way you can do this in javascript? I know you can destructure a list using ... but I am not sure how I can desctructure a dictionary. Please help.

Thanks!

Yang K
  • 407
  • 4
  • 13

0 Answers0