Max Glenister

Web Dev • 3 min read Plain text

Javascript/jQuery challenge of the week 07/03/11

Okay well this is something Tomas and I have been planning to do for ages, and in fact we did something like this a year ago, but it didn’t amount to a lot.

The premise is that we set a challenge and then both approach it in our own ways without discussing methods/ideas until the task is complete.

The task this week is as follows:

With just the JavaScript/the jQuery core file (no plugins), create functions to process some paragraphs of Lorem Ipsum in the following ways

  1. sort words by frequency of occurrence (bonus points for listing totals, most frequent word, unique words, etc.)
  2. sort words in alphabetical order
  3. sort words by length of word (ascending/descending)
  4. a function to return the text to its original order, and also reverse the original order
  5. Bonus: add some kind of effect during processing while re-arranging words

The only rules are that we must only use pure JavaScript and the jQuery core library, we can’t discuss our ideas/methods with each other, can’t compare code until the end of the challenge, can’t reuse functions made by somebody else (though we can Google for similar code patterns, they must be implemented in our own way)

The text to be processed:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo > ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis > parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, > pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim > justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu > pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper > nisi. Aenean vulputate eleifend tellus.

Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam > lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra > nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam > ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi.

Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna.

The challenge ends on Friday 11/03/11, or Saturday morning.

  • Tinkering · shares #programming
    Android Auto on my HR-⁠V's Android 4.0.4 head unit

    I recently bought a 2018 Honda HR-V as our family car. It has a 7” touchscreen running Android 4.0.4, a version so old it predates Android Auto by about three years. It runs Android Auto now anyway, thanks to a small app I built over the course of a week.

    November 2026 • 7 min read
  • Data & Experiments · shares #programming
    Rebuilding and analysing 4 years of Wordle stats from WhatsApp chat logs

    Yes, I’m still playing Wordle in 2026. According to Wordle, I’ve played 1,559 games, I win 99% of the time, my current streak is 107 days and my longest is 278. Four numbers, and they’re mostly correct. What I don’t get is anything behind them. No per-game history. No way to compare a Tuesday to a Sunday. No sense of whether I’ve actually got better at this over four years. Each day I’ve played, I’ve also shared the result to WhatsApp. Just a habit, not a data strategy, but it turns out that habit quietly built a far more detailed record than Wordle itself ever keeps. One I can finally ask my own questions of. So I looked into rebuilding my own copy of the data.

    July 2026 • 10 min read
  • Data & Experiments · shares #programming
    What's the most popular number in Hacker News titles?

    Two consecutive titles on the HN front page yesterday had a 6 in them. This means nothing. But it’s the sort of nothing that lodges in your brain until you do something about it, so what is the most popular number in Hacker News titles?

    July 2026 • 7 min read

Discussion

No interactions yet

Join the conversation

Reply from your own site with a Webmention (how?).

Webmentions last fetched 17 November 2026, 13:05