title: javaScript - pass object as function argument
body: <p>I want to use an object as function argument. When I define an object outside fucntion and then pass it as an argument, it works fine: </p>
  
  <pre><code>var obj = {
    a: 0
  }
  
  function foo(obj){
    console.log(this.obj.a); 
  }
  
  foo() //0
  </code></pre>
  
  <p>But when I pass an object directly, it doesen't work:</p>
  
  <pre><code>function bar({a: 0}){
    console.log(this.arguments.a)
  }
  // Uncaught SyntaxError: Unexpected number
  </code></pre>
  
  <p>An object doesent seem to be a legal argument. How do I fix it?</p>