This assignment continues the pattern and work started on lab day. You
will continue adding functions to hw5.js and demonstrating those
functions (in your HTML code) each in separate sections labeled with meaning h2
heading. The output should include what the functions calls look like and what
they return. You should include multiple meaningful test cases for each problem.
Write and demonstrate the following functions:
that accepts a string of zero or more words (separated by spaces).
The function should rearrange the string so the words are placed in
alphabetical order (joined by spaces). You can assume all words are
composed only of lowercase letters and that there is no punctuation.
alphabetize("hello to the earth") should return
"earth hello the to". HINT: use split to move the words
from the string into an array, sort the array, and the rejoin them.
accept as a parameter an integer and will return the number with its
digits in reverse order. NOTE: When calling the function you must
pass a number (not a string).
accepts an integer n in the range 4 to 30 and will return a randomly
generated password have n characters. The password should be
composed of random characters from the set of lower-case letters,
upper-case letters, digits, and symbols derived from holding SHIFT while
typing digits on the keyboard. If n is out of range then it should produce
a 10 character password.
an array of zero or more numbers will calculate and return an array
containing the prefix sum of the parameter. An example of a prefix sum:
a= [4, 5, 2, 2, 3]
prefix_sum= [4, 9, 11, 13, 16]
A value at position i of a prefix sum array is the sum of the
values at positions 0 .. i of the original array.
Your hw05 directory on the server should contain hw5.js that contains
As always, have fun!