title: Sort key pair value array in TypeScript
body: <p><a href="https://i.stack.imgur.com/VLUhs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VLUhs.png" alt="enter image description here"></a>Following is dynamic array in TypeScript and I want to sort it by activation date in descending order.</p>
  
  <pre><code>notificationList = [];
  
  notificationList = [ {"Id:11", "ActivationDate":"29-Jan-2018"},
  {"Id:21", "ActivationDate":"22-Jan-2018"},
  {"Id:8", "ActivationDate":"01-Feb-2018"},
  {"Id:10", "ActivationDate":"25-Jan-2018"},
  {"Id:12", "ActivationDate":"24-Jan-2018"},
  {"Id:05", "ActivationDate":"28-Jan-2018"},
  {"Id:04", "ActivationDate":"24-Jan-2018"},
  ]
  </code></pre>
  
  <p>I am sorting using below code but it's not giving me expected output.</p>
  
  <pre><code>this.notificationList = this.notificationList.sort(function(a, b): any {
                const dateA = new Date(a['ActivationDate']);
                const dateB = new Date(b['ActivationDate']);
                console.log('dateA -' + dateA);
                console.log('dateB -' + dateB);
                console.log(dateB &gt; dateA);
                return dateB &gt; dateA; //sort by date decending
            });
  </code></pre>
  
  <p>Any suggestion or input ?</p>