//click anywhere to proceed or
//use keyboard left & right arrow 
var visits = [6, 9, 11, 2, 12, 5], 

    max = 0;

//max=?	
for (var i=0; i<=visits.length; i++)
{
   if (visits[i] > max)
   {
     max = visits[i];
   }
} 
//max=12
var max = _.max(visits);

//max = 12
var uniqTest = 

_.uniq([1,5,4,4,5,2,1,1,3,2,2,3,4,1]);
 
// [1, 5, 4, 2, 3]
var visits = [6,9,11,2,12,5,6,10], 

    topVisitors = [], 

    visitLimit = 10;
for (var i=0; i<=visits.length; i++)
{
   if (visits[i] >= visitLimit)
   {
       topVisitors.push(visits[i]);
   }
} 
//[11, 12, 10]
topVisitors =
 
_.filter(visits, function(visit){ 

   return visit > visitLimit;

}); 

//[11, 12, 10]
var visitors = [
				{name:'JScripter1', visit:6}, 
				{name:'JScripter2', visit:9}, 
				{name:'JScripter3', visit:11}, 
				{name:'JScripter4', visit:2}, 
				{name:'JScripter5', visit:12}, 				
				{name:'JScripter7', visit:10}], 
    topVisitors = [], 
    visitLimit = 10;
topVisitors = 

_.filter(visitors, function(visitor){

   return visitor.visit>=10;

});

//[{name: "JScripter3", visit: 11},
//{name: "JScripter5", visit: 12},
//{name: "JScripter7", visit: 10}]
names = 

_.pluck(topVisitors, 'name')

//["JScripter3", "JScripter5", "JScripter7"]
_.where(listOfPlays, {author: "Shakespeare", year: 1611});

// [
//{title: "Cymbeline", author: "Shakespeare", year: 1611},
//{title: "The Tempest", author: "Shakespeare", year: 1611}
//]
_.groupBy([1.3, 2.1, 2.4, 3.8], 

  function(num){ 

     return Math.floor(num); 

  });

// {1: [1.3], 2: [2.1, 2.4], 3:[3.8]}

_.shuffle([1, 2, 3, 4, 5, 6]);

// [4, 1, 6, 3, 5, 2]

_.map([1, 2, 3], function(num){ 

     return num * 3; 

 });

 // [3, 6, 9]

//similar

_.find //first match of filter
_.findWhere //first match of where
_.reject // opposite of filter
_.sortBy 

Array

_.union(
	[1, 2, 3], 
	[101, 2, 1, 10], 
	[2, 1]
	);

// [1, 2, 3, 101, 10]
_.intersection(
	[1, 2, 3], 
	[101, 2, 1, 10], 
	[2, 1]
	);

// [1, 2]
_.difference(
	[1, 2, 3, 4, 5], 
	[5, 2, 10]);

// [1, 3, 4]
_.object(
	['moe', 'larry', 'curly'], 
	[30, 40, 50]
	);

//{moe: 30, larry: 40, curly: 50}

_.object([
	['moe', 30], 
	['larry', 40], 
	['curly', 50]
	]);
	
// {moe: 30, larry: 40, curly: 50}

Object

_.keys({
	one : 1, 
	two : 2, 
	three : 3}
	);

// ["one", "two", "three"]
_.values({
	one : 1, 
	two : 2, 
	three : 3
	});

// [1, 2, 3]
_.invert({
	Moe: "Moses", 
	Larry: "Louis", 
	Curly: "Jerome"
	});

// {Moses: "Moe", Louis: "Larry", Jerome: "Curly"};

Function

//once
var initialize = _.once(createApplication);

initialize();

initialize();

// Application is only created once.
//after
var renderNotes = _.after(notes.length, render);


// renderNotes is run once, 
//after all notes have saved.

//bind
var func = function(greeting){ return greeting + ': ' + this.name; };

func = _.bind(func, {name : 'moe'}, 'hi');

func();
// 'hi: moe'
//throttle
var throttleSometing = 
  _.throttle(doSomething, 100);

function doSomething(){
	//something
}

throttleSometing();
//debounce
var debounceSomething = 
   _.debounce(doSomething, 300);

function doSomething(){
	//something
}
debounceSomething();
Once throttle Debounce Demo

Extra

//& < > "'/
_.escape('Curly, Larry & Moe');

//"Curly, Larry & Moe"

_.unescape('Curly, Larry & Moe');

// "Curly, Larry & Moe"
template
chaining

[email protected]