Create Your Own Mission Statement

I don't like mission statements and think that the real reason for having one is either because it's currently the "in" thing to have or because creating one can keep someone in a job (probably a consultant who is charging the company a fortune!).

The mission statement is randomly generated every time the page is loaded. There is a basic template into which words are added at random. There is actually a pattern because the template is, "Our mission is to [adverb] [verb] [adjective] [noun], so we can build on [adjective] [noun] and [adjective] [noun], taking us forward to meet new challenges." I have marked the fixed and random text in the source of this page so you should be able to write a longer statement with a different style quite easily.

The page loads in an external javascript file which just holds the random words and counts how many of each there are. The script which displays the statement itself is in the page.

The external file looks something like this:–

 noun = new Array(





 verb = new Array(





 adjective = new Array(





 adverb = new Array(





 lenn = noun.length

 lenv = verb.length

 lenj = adjective.length

 lena = adverb.length

This is saved as "mission.js". "lenn", "lenv", "lenj" and "lena" count the lengths of the arrays. Because these are arrays we are talking about they return the number of items within each array rather than number of characters. You can add lots more words to each list but make sure that they all have commas after them except for the last one. You don't have to put each new word on a new line. I only did that and put the words in alphabetical order because it makes it easier to add new words. In my list I have used English spellings rather than American ones because I am English. I suppose, to make the mission statements into genuine authentic gibberish, I should have used the American ones!

The external file is called in the page using the following code (which goes in the page's <HEAD>):–

<script src=mission.js>


The script which displays the code is in the page itself. You can look at it by viewing the source for this page. The start and end are carefully noted. One thing I should probably point out is the way that random numbers work. Javascript generates random numbers between 0 and 1 (but not as high as 1) so you have to multiply by the maximum number you want. In this case that is the number of items in each array. The first item in an array is always number 0 so, with 10 items, they run from 0 to 9. This means that if you take an integer (which always rounds down) of the random number multiplied by the length of the array (doing the multiplication before you take the integer) you will get a number from 0 to the last item's number inclusive. If your list of possible numbers started at 1 instead of 0 you would have to add 1 after arriving at the integer so that you don't get any zeroes. If this doesn't make sense, don't worry. Look up javascript arrays on the internet and you might find someone else has explained it better than me!

In my example I have only got the four random types of text. There is nothing to stop you replacing some of the fixed text with complete phrases, selected at random in a similar manner. Just set up a separate array, make sure there is a counter (like "lenn", "lenv", etc.) so you don't have to keep changing the number in the code every time you add a new phrase, and off you go.

I suppose, taken to its limit, you could have separate arrays for all the different types of words (e.g. past participle, 1st person singular present indicative, etc) and could make up a template based on, say, the words of a poem which uses no fixed text at all. It would be easy enough to include javascript to check whether text following a wholly random word should be restricted in its gender, number or time (e.g. past present or future), or to capitalise the the first letters of words where necessary (unless your name is cummings, of course). The really time consuming bit would be filling up the dictionary.

Hand coded using KEdit
© 2003 Phil Davison