Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var foods = ['hotdog', 'hamburger', 'soup', 'sandwich', 'hotdog', 'watermelon', 'hotdog']; var result = _.chain(foods).countBy().pairs().max(_.last).head().value(); console.log(result);</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore.js"&gt;&lt;/script&gt;</code></pre> </div> </div> </p> <blockquote> <p><strong><a href="http://underscorejs.org/#countBy" rel="nofollow noreferrer">countBy</a></strong>: Sorts a list into groups and returns a count for the number of objects in each group.</p> <p><strong><a href="http://underscorejs.org/#pairs" rel="nofollow noreferrer">pairs</a></strong>: Convert an object into a list of <code>[key, value]</code> pairs.</p> <p><strong><a href="http://underscorejs.org/#max" rel="nofollow noreferrer">max</a></strong>: Returns the maximum value in list. If an iterator function is provided, it will be used on each value to generate the criterion by which the value is ranked.</p> <p><strong><a href="http://underscorejs.org/#last" rel="nofollow noreferrer">last</a></strong>: Returns the last element of an array</p> <p><strong><a href="http://underscorejs.org/#first" rel="nofollow noreferrer">head</a></strong>: Returns the first element of an array</p> <p><strong><a href="http://underscorejs.org/#chain" rel="nofollow noreferrer">chain</a></strong>: Returns a wrapped object. Calling methods on this object will continue to return wrapped objects until value is used.</p> <p><strong><a href="http://underscorejs.org/#value" rel="nofollow noreferrer">value</a></strong>: Extracts the value of a wrapped object.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload