This is a jQuery coding sample I wrote on request. It screen-scrapes some Wikipedia pages, and then replaces content on one of the pages with word count information.
JavaScript CSS HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
css
js
.gitignore
README.md
index.html
output.png

README.md

#replaceWordsInPage This is a coding assignment I supplied for an employer. It demonstrates:

  • Screen-scraping of Wikipedia pages
  • Word-counting
  • Sorting
  • Replacing text in an HTML page
  • Definition of rules for counting words
  • The Module pattern
  • Promises
  • CSS selectors
  • jQuery coding

The solution can also be found at this jsFiddle.

###Assignment Objective:

To create an algorithm written in JavaScript that replaces the top 25 most common words based on their frequency with the their count inline. Your code should be pasteable and runnable in the browser console.

###Requirements:

  • Page to process and run your code on: https://en.wikipedia.org/wiki/Programming_language
  • A word may not include HTML tags, JavaScript code, numbers, spaces or punctuation.
  • A word may notbe from the top 100 common words in english and you may not hardcode these into the source code https://en.wikipedia.org/wiki/Most_common_words_in_English
  • Also please remove common words “are”, “is”, “where”, “was” and any single characters
  • You may use JQuery and standard JavaScript but no other third party library
  • Your code should be runnable on recent Chrome or Firefox browser.

###Example:

  1. Open Chrome and navigate to your html file on disk.
  2. The page should update to look like the image below. It is okay if your counts are off by a few. Smaller icon