Finding the Object Property with the highest value in javascript -


Say I was made an objectively similar ...

  var indexes = {}; For (var i = 0; i & lt; specchar.length; i ++) {index [specature [i]] = str.indexOf (specchar [i]); }  

How do I find the property with the highest value?

The most effective way to keep track of the maximum value is because your object is being dynamically created:

  var indexes = {}; Var maxVal = str.indexOf (specchar [0]); // greatest value in var maxKey = ''; // It is important for the largest value (var i = 0; i & lt; specchar.length; i ++) {var val = str.indexOf (specchar [i]); If (Val & gt; Maxwell) {maxVal = val; MAXK = Spectacular [I]; } Index [Specchar [i]] = Well; }  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -