Skip to content

Instantly share code, notes, and snippets.

View iMetro's full-sized avatar
💭
A Date is a date

iMetro

💭
A Date is a date
View GitHub Profile
@iMetro
iMetro / jQueryGems.js
Created September 13, 2012 11:52 — forked from jgable/jQueryGems.js
Modern Web Development Blog Post code - jQuery Gems
var nums = [1,2,3,4,5,6,7,8,9,10];
// $.each is a simple foreach helper
$.each(nums, function() { if(this % 2 === 1) { log("Found an odd number"); });
// $.grep is a filter for a list
var odds = $.grep(nums, function() { return this % 2 === 1; });
// $.map is a projection of a list
var labels = $.map(nums, function() { return "Number " + this; });