javascript sorting a map based on it's attribute and return map

68 Views Asked by At

I am trying to sort a map which is inside a filter and return the map

  var sort = this.attr('component').attr('sort');
  if (sort == 'Price Descending')
  {
     return this.attr('%root.products').filter(function(product) {
            // How can I sort 'product' here before returning? 
            return (product.attr(product.attr('active') !== 'f';
     });
  }

As mentioned above how can I sort the product callback variable before returning and comparing it.

Any help would be appreciated.

0

There are 0 best solutions below