Skip to content

Instantly share code, notes, and snippets.

@heapwolf heapwolf/6.js
Created Jul 19, 2012

Embed
What would you like to do?
intro/closures
var parcels = [2, 5, 10, 42, 67, 78, 89, 120];
var sum = 0;
function sumParcel(parcel) {
sum += parcel;
}
parcels.forEach(sumParcel);
console.log('sum: ' + sum);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.