title: ReactJS Binding invalid left-hand side in function parameter list
body: <p>I need to filter out top 5 objects in a list based on their count. So I decided to sort them first. Here's the list</p>
  <pre><code>myList=[
     {name: &quot;name1&quot;, count: 12},
     {name: &quot;name2&quot;, count: 8},
     {name: &quot;name3&quot;, count: 42},
     {name: &quot;name4&quot;, count: 22},
     {name: &quot;name5&quot;, count: 0},
     {name: &quot;name6&quot;, count: 18},
     {name: &quot;name7&quot;, count: 0},
     {name: &quot;name8&quot;, count: 1},
  ]
  </code></pre>
  <p>And this is my sorting code</p>
  <pre><code>SortData = () =&gt; {
          let data1 = [...this.state.myList]
          data1.sort((a - b) =&gt; {
              return a.count - b.count
          })
      }
  
  </code></pre>
  <p>However, I am getting an error in React as</p>
  <pre><code>SyntaxError: Binding invalid left-hand side in function parameter list   
  at data1.sort((a-b) =&gt; {
                 ^
  </code></pre>
  <p>I am not able to figure out what's wrong. Can someone please help with a code to sort the list based on count and also filter out the top 5. Thanks</p>