0

This is my data

var data = [{
    "name": "abc",
    "cap": 12
}, {
    "name": "pqr",
    "cap": 10
}, {
    "name": "xyz",
    "cap": 50
}

Now here I want to get max value of "cap" i.e 50. Is there any function to do so. Something like max(data['cap']) ?

Thanks

Domnick

9
  • There is a way, can you show your try? Commented Mar 5, 2018 at 10:58
  • Math.prototype.max( null, data.map( s => s.cap ) ) Commented Mar 5, 2018 at 10:59
  • @Learnonhardway That is a little bit of a foolish comment, lol. Commented Mar 5, 2018 at 10:59
  • Have you tried anything? Commented Mar 5, 2018 at 11:00
  • 1
    @AndrewBone yep, that's better as it's less verbose. Commented Mar 5, 2018 at 11:04

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.