For each of the following, you should write Javascript functions that work on any input string, but you are not required to test the functions beyond what is presented in the skeleton.
In the following problems, Use only the primitive string methods (and properties): concatenation (+) == indexing (str[index]), length, charAt() (indexing is usually easier than using charAt). Do not use: match replace indexOf, etc. Use console.log() for all output.
str itself. For example: str = 'cat' prints out as 'tac' (but on 3 separate lines in the console window)str in reverse order. Do not change str itselfstr so that the characters are in reverse order. Examine the versions of this. It can't be done. Strings are passed by value not by reference. count(str,fn), where fn is a function that takes one parameter which must be a single character. The function returns either true or false. True means count it and false means dont count it. In Java terms:
boolean fn(char c)
. Write an isVowel(ch) method. You will get the same value returned from countVowels(str) as from count(str,isVowel).All output will be in the Firebug console. Your output should be like this screen shot.
The script in the head element of this page contains the skeleton for this program. It starts with a 'main' section that calls each of the methods you are to write. You do not have to change the 'main' section. Fill in the code for each of the methods. You do not have to test or include a Test Plan.
Turn in the following in the following order:
The following assignment will be 'Advanced String Processing' using: match, replace, indexOf.
Javascript string, method writing, methods as objects, and parameter passing