javascript - Is there a way to get both the argument name and value while looping over arguments array? -


I am preparing a query string with the arguments given for the JavaScript function. I'm looping on the logic array and I want to argumentsName and its value.

Location

You have to type the function differently, because you ask It is not possible to do that, and if you think about it, then in reality it has no meaning; What if your function is combined with expression and other function calls in the logic list?

Instead, type a function like this:

  The function is {object (for argName in object) {if (object.hasOwnProperty (argName)) { Var argValue = object [argName]; // now argName is an argument name, and // is the argValue value, and you can // whatever you want}}}  

when you call function You will do this:

  if (whatever) your function ({arg1: value1, arg2: value2, arg3: value3});  

Comments