Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 3
    Why do you use new Object instead of just {}? And what does this actually accomplish? The only way OPs question makes any sense is if he wants to filter whats in req.body` -- because that already is an object and he does not need any destructuring only to then make it (the same) object again. Typo in lasName, 2nd piece of code. Is there any less code now than compared to using destructuring and then making an object as usual? (Answer: No there isn't.) OP already does it in two simple lines of code. All "solutions" posted here are more complicated than what OP already got. Commented Oct 22, 2017 at 7:43
  • @Mörre What is issue with using new Object? Commented Oct 22, 2017 at 7:51
  • @Mörre "All "solutions" posted here are more complicated than what OP already got." Have you considered posting that sentence as an Answer? Commented Oct 22, 2017 at 7:53
  • 1
    stackoverflow.com/q/4597926/1048572 Commented Oct 22, 2017 at 15:57
  • @Bergi And stackoverflow.com/questions/4597926/… ? Commented Oct 22, 2017 at 16:02