function log(tobelogged){
if (debugging){
c.log(arguments);
c.log(arguments.toString());
c.log(tobelogged);
};
};
and then
log(someObject);
and I want to response
'someObject'
'whatever is in someObject'
I tried toString() above but clearly I’m missing something. How do you get the ‘name’ of what’s sent to the function? The example uses oni apollo stratified sjs in the browser but I don’t think it matters here. Anyy ideas?
An argument doesn’t have a name. It only has a reference via a parameter, or via an index of the
argumentsobject. The parameter name is an indirect reference from the parameter to an index in theargumentsobject.In strict mode, there’s even less of a correlation, since you can modify the values of the parameters without affecting the value of the arguments object, and vice versa.
I think the closest you’ll come is using…
…which should give you an expandable object, so you can see the arguments by index.