Question
Define the variableattributes = ;;. Using W3 schools find and read the documentation for an appropriate function that might be used to cut up a
Define the variableattributes = ";;". Using W3 schools find and read the documentation for an appropriate function that might be used to cut up a string into an array of parts that were separated by a given character in that string. e.g. "a;b;c" would give an array of parts ["a","b","c"] if asked to separate by ";". Give an example of calling this function and the resulting output if any to get the name, age, and major substrings inattributes:
varattributes = ";;"
varpieces =attributes.split(";");
b. (3 minutes) How many parameters does this function take? How do you know what the parameters are and what values they expect? Is it necessary to place the parameters in a certain order? Why/why not?
c. (4 minutes) What parameters are required? What are optional? How did you know? Give an example of using an optional parameter for this function.
d. (2 minutes) Is the function named appropriately? Explain why or why not.
e. (5 minutes) Explain why it is not necessary to give the string inattributes as a parameter to the function. How does this work and why this is better than putting the string directly in the function call. Why is this different thanparseInt() where you do have to put the string in as an argument?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started