parameters - Using named arguments in Javascript with regular expressions as names of arguments -
parameters - Using named arguments in Javascript with regular expressions as names of arguments -
is possible utilize named arguments in java or javascript regular expressions names of arguments? want create possible phone call function this:
f("function name:", "drawcircle", "radius:" 1, "xpos:" 0, "ypos:", 0, "color:", "red");
or this, same effect:
f("name of function:", "draw circle", "y position:", 0, "color:", "red", "rad:" 1, "x location:" 0);
both of these should equivalent foo(1, 0, 0, red).
in both cases, arguments given should match list of regular expressions. should possible list arguments , function name in order same result.
is there way implement this?
f({ "name": "drawcircle", "radius": 1, "xpos": 0, "ypos": 0, "color": "red" });
this why utilize objects in javascript.
although want
drawcircle({ radius: 0, x: 0, y: 0, color: "red" });
javascript parameters arguments named
Comments
Post a Comment