Array Find And Replace Javascript Function Parameters Passing