title: Finding difference between consecutive numbers in an array in javascript
body: <p>I have the following array</p>
  
  <pre><code>A=[1,2,3,3,0] 
  </code></pre>
  
  <p>and if I want to calculate difference between consecutive numbers in an array. I could do it in Matlab with using built-in function (<code>diff</code>)</p>
  
  <p><code>B=diff(A)</code> returns </p>
  
  <pre><code>B = [1,1,0,-3]
  </code></pre>
  
  <p>I would like to know there is any similar built-in function in javascript?</p>