Refactor arguments into object argument
A relatively common Javascript refactoring.
Start file
function foo(hello, world,
how, are,
you) {
}
End file
function foo(parameters) {
var hello = parameters.hello;
var world = parameters.world;
var how = parameters.how;
var are = parameters.are;
var you = parameters.you;
}
View Diff
1,3c1,6
< function foo(hello, world,
< how, are,
< you) {
---
> function foo(parameters) {
> var hello = parameters.hello;
> var world = parameters.world;
> var how = parameters.how;
> var are = parameters.are;
> var you = parameters.you;
Solutions by @ischi:
Unlock 2 remaining solutions by signing in and submitting your own entry