Back to Lesson # 4 - Functions | Review Questions | Back to Main Menu |
2. Modify the function in question 1 so it can make a little change in the user's name. Have it use 'var' to declare a function variable(var capsName;). Assign the value of the input box to be stored in the variable as all upper case letters. How can you do that? Use the function called toUpperCase(). It is a member of the string object, so to use it, type the name of the string variable (the object), followed by the dot, and the method name 'toUpperCase();'.
( capsName = userName.toUpperCase();)
Notice that we are sending information to this pre-written function. Then display the name in the greeting in capital letters.
3. Write and test the function called 'getSerial()' that is described in Lesson #4. This is good practice for returning a value from a function.