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.

4
  • developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/… Commented Dec 12, 2018 at 13:59
  • It's not clear from your example what you're trying to achieve. You're creating an object only to deconstruct it again. What's the point? Why not create an object with those variables and you wouldn't have to deconstruct it. What are you returning from the function? The object, x? You should really provide your quesiton with more details. Commented Dec 12, 2018 at 14:18
  • the function is just simplified, and it is very clear that it accebts an object, but if no argument passed it will use a default one Commented Dec 12, 2018 at 15:11
  • 1
    Please, provide your real code instead of abstractions. Why should obj be defined in function scope? As it was said, it's unclear what you're trying to achieve. Commented Dec 12, 2018 at 15:20