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

c++ - C/pp Sockets, recv()/send() works only under gdb -

GO: Serve static pages -

objective c - How to open front/back camera at the same time in iOS developing? -