Skip to content
Advertisement

Compare and Filter Object Array in javascript

How to determine the cheapest and fastest rate and get the value in single object.

  • cheapest is determined by using netfee having least value
  • fastest is determined by using speed having less days
  • best is determined by using amount having highest value

I got stuck and let know is any alternative solution.

JavaScript
JavaScript

Advertisement

Answer

so simple..

JavaScript

[edit]: Thanks to muka.gergely for his remark on parseInt(acc.speed,10) (specify to use base 10)
for memo : console.log(parseFloat('0.7 days') return = 0.7

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement