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
- sort words by frequency of occurrence (bonus points for listing totals, most frequent word, unique words, etc.)
- sort words in alphabetical order
- sort words by length of word (ascending/descending)
- a function to return the text to its original order, and also reverse the original order
- 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.
This post is also available in plain text
GitHub API rate limit exceeded. Comments available again at