Metawaa Metawaa - 29 days ago 10
jQuery Question

Item in object has two value need the second value jquery

I have an object that has two value "384-768" how can I get the second value for all of the Items. if the item has two value get the highest one if its only one return that one only. how do I get that from the object?

Answer

You can get second value using split (it splits strings to array by separating the string with passed argument)

"384-768".split('-')[1]

and find in loop maximal element (after converting to integer with parseInt)