MidPath hiring

You are given a string variable called 'original'. You need to write a javascript program that uses this variable and assignes a new value to another variable called 'computed' according to the given rules.

If the character is a digit, leave it unchanged. If the position of the character is a multiple of 3 then rotate the character by 5. If the position of the character is a multiple of 5, rotate it by 9. However, if the character's position is a multiple of both 3 and 5, rotate it by 3. If none of these conditions are satisfied, rotate the character by 2.

In order to rotate a character, say 'k' by an amount of 4 we need to find the character 4 places before 'k' in alphabetical order which turns out to be 'g'. Consider only lowercase a-z characters and assume that they are cyclic in nature.

When you have written your program, click on 'Run program' button and the link text below will change. If your program is correct, clicking on it will take you to the next step in the hiring process, if it is wrong, you will reach a 404 page.