Skip to content

Instantly share code, notes, and snippets.

View mpj's full-sized avatar

Mattias Petter Johansson mpj

View GitHub Profile
function reduce(arr, fn, initial) {
//there's no more elements in the array, we return I get that
if (arr.length === 0) {
return initial;
} // base case, does not recurse
// we are calling the actual function here with the first element in the array
//I don't get what initial is ??
@mpj
mpj / gist:3190504
Created July 27, 2012 21:17 — forked from idan/gist:3135754
A Sample Post

Hello there! This is a sample post for gist.io, a super-lightweight writing soapbox for hackers.

Now look up. Further. Above the post title. See that grey text with the gist ID?

Now back to me. That grey text is a link! Open that sucker in a new tab to see the source for this post. Also, I'm on a horse.

This is a major heading

If you peek at it with a web inspector, you'll see that it is a second-level heading. You can use first level headings, but they'll look just like the second level ones, and the gods of the HTML5 outlining algorithm will frown upon you.